I have a C# Windows application that uses a DataGridView with three columns. The first is a textbox that requires no validation. The second and third columns are both checkboxes. I need help with determining if the boxes are checked or not. If they are then I would like to set the background color of the checkbox cell to red. I am using the DataGridView1_CellContentClick event for this. Any help or suggestions would be appreciated.
3 Answers
0
votes
0
votes
-1
votes
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
Try
If e.ColumnIndex = 8 Then
Label1.Text = DataGridView1.Rows(e.RowIndex).Cells(0).Value
FrmVisits.Show()
ElseIf e.ColumnIndex = 9 Then
Label1.Text = DataGridView1.Rows(e.RowIndex).Cells(0).Value
FrmPEdit.Show()
Else
Exit Sub
End If
Catch ex As Exception
Exit Sub
End Try
End Sub