What is the point the purpose of this code?

Originally Posted by
blakemckenna
Code:
If CBool(cell.Value) <> False Then
cell.Value = False
Else
cell.Value = True
End If
If your goal is to prevent changes, then that code might have relevance if the changes were committed by executing a second CommitEdit(DataGridViewDataErrorContexts.Commit) statement.
The CurrentCellDirtyStateChanged event will fire after as the cell value changes. The CommitEdit(DataGridViewDataErrorContexts.Commit) method will tell the DGV to accept the change as the current value.
If your goal is to respond immediately to changes based on the cell value, then:
Code:
If CBool(cell.Value) Then ' note that you should not test if a boolean = True/False, i.e.: CBool(cell.Value) = True
' execute code for when true
Else
' execute code for when false
End If
Do not try to set the cell value in code.