Question DatagridView CheckBoxColumn

smoksmanh

New member
Joined
Nov 15, 2011
Messages
2
Programming Experience
3-5
I have the 2 check box columns in the Datagridview. both of two columns are unbound.
I Want to write condition when i click on column 2. ( if column1=false than alert msg(".....") and set check box column 2 to Uncheck)
Here is my code :

Private Sub DTGapprovallist_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DTGapprovallist.CellContentClick
If e.ColumnIndex = 1 Then
If DTGapprovallist.CurrentRow.Cells("col1").EditedFormattedValue.Equals(False) Then
DTGapprovallist.CurrentRow.Cells("Col2").Value = False
MsgBox("..............................", MsgBoxStyle.Critical)
End If
End If
End Sub

In this event the column 2 doesn't set back to Uncheck.so please help me to solve this problem. what event should i use?
 
Thx bro, but in this condition, the user have to first check on column1. if the user first check on the second column i have to alert to them "The First column must be checked first" and i want my code to cancel the second column "DTGapprovallist.CurrentRow.Cells("Col2").Value = False". unfortunately, the message alert but the second column still checked. any options that can guide me to do as this condition?
 
Last edited:
Back
Top