I have a program and it looks like this
please be focused on the value the one with checked and color red.
Lets say I will click a cell (checkboxcolumn)
if I click a cell a Msgbox will show first sayon Are you you want to update changes?
If I click Yes
the program will check its current value and Update it something like this.
If value = yes then
value = No
ElseIf value = no then
value = Yes
end if
and if I select NO
in the msgbox the value of the current cell will remains the same.
here is my code
If (e.ColumnIndex = 1 AndAlso e.RowIndex >= 0) Then
Dim value = DirectCast(DataGridView1(e.ColumnIndex, e.RowIndex).FormattedValue, Nullable(Of Boolean))
Dim result = MessageBox.Show("Are you sure to uncheck item?", "", MessageBoxButtons.YesNoCancel)
If (value.HasValue AndAlso value = True) Then
If (result = System.Windows.Forms.DialogResult.Yes) Then
If DataGridView1(e.ColumnIndex, e.RowIndex).Value = True Then
DataGridView1(e.ColumnIndex, e.RowIndex).Value = False
Else
DataGridView1(e.ColumnIndex, e.RowIndex).Value = True
End If
ElseIf (result = System.Windows.Forms.DialogResult.No) Then
End If
Else
End If
End If
My Question is.
How can I check the the value of cell and turn it vice-versa when I click Yes in the messagebox? and Remains the value or return to its original value when I click NO in the messagebox.
I try my code above but it looks not working
TYSM