![](/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.