如何在表单加载时使DataGridview中的复选框自动选中?
试图将该代码放入表单加载中,但现在可以了
Dim chkbox As New DataGridViewCheckBoxColumn
DataGridView4.Columns.Insert(0, chkbox)
For Each row As DataGridViewRow In DataGridView4.Rows
Dim cell As DataGridViewCheckBoxCell = row.Cells(0)
cell.Value = True
Next
答案 0 :(得分:0)
假设您已经有一个空的第0列,则可以执行以下操作:
For Each row As DataGridViewRow In DataGridView4.Rows
row.Cells(0) = New DataGridViewCheckBoxCell With {.Value = True}
Next