![](/img/trans.png)
[英]How to add dynamically control when checkbox in datagridview is checked vb.net
[英]How to keep the checkbox checked in DatagridView Checkbox vb.net
如何在表单加载时在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,那么您可以这样做:
For Each row As DataGridViewRow In DataGridView4.Rows
row.Cells(0) = New DataGridViewCheckBoxCell With {.Value = True}
Next
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.