VB.NET - How To Add DataGridViewCheckBoxColumn To Datagridview Using VBNET
In This VB.NET Tutorial We Will See How To Add A Check Box Column To Datagridview
In VBNET Programming Language.
In VBNET Programming Language.
Project Source Code:
Public Class VB_add_checkbox_to_datagridview
Private Sub VB_add_checkbox_to_datagridview_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' add some row to datagridview
' true the checkBox Is checked
' false the checkBox Is Not checked
DataGridView1.Rows.Add(True)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(True)
DataGridView1.Rows.Add(True)
DataGridView1.Rows.Add(True)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(True)
DataGridView1.Rows.Add(False)
DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
DataGridView1.AllowUserToAddRows = False
''''''''''''''''''''''''''''''''''''
Dim dgvCheck As New DataGridViewCheckBoxColumn()
dgvCheck.HeaderText = "Check Box"
DataGridView2.Columns.Add(dgvCheck)
DataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
DataGridView2.AllowUserToAddRows = False
DataGridView2.Rows.Add(False)
DataGridView2.Rows.Add(True)
DataGridView2.Rows.Add(False)
DataGridView2.Rows.Add(True)
DataGridView2.Rows.Add(False)
DataGridView2.Rows.Add(False)
DataGridView2.Rows.Add(True)
DataGridView2.Rows.Add(False)
DataGridView2.Rows.Add(True)
DataGridView2.Rows.Add(True)
End Sub
End Class
///////////////OUTPUT:
Download Projects Source Code