how to change the color in datagridview row when i check the check box in C# windows applications?i have code for select one check box is in header column in datagridview it checks all check boxes and changing background color in a datagridview rows but i want when check one check box and corresponding datagridview row will change color please help me
private void Form1_Load_1(object sender, EventArgs e)
{
this.ckBox.CheckedChanged += new System.EventHandler(this.ckBox_CheckedChanged);
this.dataGridView1.Controls.Add(ckBox);
}
void ckBox_CheckedChanged(object sender, EventArgs e)
{
for (int j = 0; j < this.dataGridView1.RowCount; j++)
{
this.dataGridView1[2, j].Value = this.ckBox.Checked;
}
foreach (DataGridViewRow row in dataGridView1.Rows)
{
DataGridViewCheckBoxCell check = row.Cells["Chk"] as DataGridViewCheckBoxCell;
if (Convert.ToBoolean(check.Value) == true)
row.DefaultCellStyle.BackColor = Color.Wheat;
else
row.DefaultCellStyle.BackColor = Color.White;
}
this.dataGridView1.EndEdit();
}