0
 DataGridViewCheckBoxColumn  Checking Issue

I added a DataGridViewCheckBoxColumn to My Data Grid
Dim DesChkBox As New DataGridViewCheckBoxColumn
DesChkBox.Name = "chbSelect"
DesChkBox.HeaderText = "Select"
DesChkBox.TrueValue = True
DesChkBox.FalseValue = False
grdView.Columns.Add(DesChkBox)
DesChkBox.Width = 50
grdView.ReadOnly = False
grdView.AutoGenerateColumns = False
grdView.RowHeadersWidth = 5

And through a procedure I want to check the Check Box programmatically.
Private Sub prcDefaultSelection()
Try
grdView.Rows(0).Cells(3).Value = True
Catch ex As Exception
MsgBox(Err.Description)
End Try
End Sub
The Check Box is not Checking. Please help me.

2
Contributors
1
Reply
13
Views
1 Year
Discussion Span
Last Post by mikeybware
0

Have you tried referring to the datagrid column by name in case it is not cell(3):

grdView.Rows(0).Cells("chbSelect").Value = True

If you prefer to use the column number, please remember that the first column is usually Cells(0). You may already know that but I am trying the obvious answers first :)

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.