Hello my friends:
I have a DataGridView in Windows Form. The First column contains check boxes.
I am able to determine if any of the boxes are checked, however, I need to know if all are unchecked.
For example:
If a user clicked on any of the check box, then do something, if the user unchecked all of the previously checked check boxes do something else.
Again, I am able to determine if a box is checked or unchecked. However, what I need is to determined is when any box is checked and when ALL boxes are unchecked.
I need this to happen each time a row is check so that I can know when the condition is met. Meaning I am not using a Button event.
What I have tried:
The following Code returns a Bool each time the user checks or unchecks a check box on the grid. This does not work because I want to know when ANY boxes are checked and if All are unchecked.
For example: Lets say the user checks 5 boxes. I only want to be notified once. And notified again when all 5 are unchecked not just the individual boxes.
Public Function IsContainChecked() As Boolean
Dim ch1 As New DataGridViewCheckBoxCell()
ch1 = DirectCast(DataGridView1.Rows(DataGridView1.CurrentRow.Index).Cells(0), _
DataGridViewCheckBoxCell)
Return CBool(ch1.EditingCellFormattedValue)
End Function