I have DataGridView
in windows form which contains 13 checkboxes. one checbox i-e(the first one) is to check all other checkboxes which are basically for months. So now I want that when I check the first checkbox all of the other checkboxes should be checked and when I uncheck the first checkbox all checkboxes should be unchecked. My code works correct when I check the first checkbox but when I uncheck the first checkbox still all checkboxes are checked. but I want them to be unchecked. I have used CellContentClick
event.
Here is my code.
if (e.ColumnIndex == 1)
{
for (int k = 2; k <= 13; k++)
{
DataGridViewCell cell = dataGridView1.Rows[e.RowIndex].Cells[k];
DataGridViewCheckBoxCell checkCell = cell as DataGridViewCheckBoxCell;
checkCell.Value = true;
}
}