Check first checkbox in datagridview

  • Thread starter Thread starter KeesBlunder
  • Start date Start date
K

KeesBlunder

Guest
Hello,

I place a checkbox's in a datagridview with some data , and you can only select one at the time.

Dim chk As DataGridViewCheckBoxColumn = New DataGridViewCheckBoxColumn()
DataGridView1.Columns.Add(chk)
chk.HeaderText = "Check"
chk.Name = "chk"

This for only one at the time.

If e.ColumnIndex = 0 AndAlso e.RowIndex >= 0 Then
For Each row As DataGridViewRow In DataGridView1.Rows
row.Cells(e.ColumnIndex).Value = False
Next
End If
Dim senderGrid As DataGridView = sender
Dim data = senderGrid.Rows(e.RowIndex).DataBoundItem

If senderGrid.Columns(e.ColumnIndex).GetType() Is GetType(DataGridViewCheckBoxColumn) And e.RowIndex >= 0 Then

'''''''' do stuf
End if

But how do i check the checkbox of the first row after formload?

Continue reading...
 
Back
Top