I have a datagridview (here called cameraTable). One column of the datagridview is purely checkboxes. I have a button that when clicked will check all the boxes in the column, aka select all. Here's the code:
Private Sub btnSelectAll_Click(sender As Object, e As EventArgs) Handles btnSelectAll.Click
For Each row As DataGridViewRow In cameraTable.Rows
DirectCast(row.Cells("CheckBox"), DataGridViewCheckBoxCell).Value = _
True
Next
End Sub
The problem I'm having is that the initial box (i.e. row zero) never changes to checked. I tried these:
DirectCast(cameraTable(0, 0), DataGridViewCheckBoxCell).Value = True ' doesn't work
cameraTable.Rows(0).Cells(0).Value = True ' doesn't work
Neither change the box to checked, but the other rows within the column change without a problem. I even did a msgbox that prints out the value, and turns out to be "True". So the value of the checkbox has changed, but the check box in the datagridview is still unchecked. Any ideas?
Thanks for all the help!
-K
false
on somewhere after settingtrue
?? – Jumpei