Selasa, 29 Maret 2016

VB NET - How To Add CheckBox Column To DataGridView In VB.NET


DataGridView CheckBox Column In VB.NET

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.


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:


VB DataGridView Check Box Column
VB DataGridView Check Box Column

Bagikan

Jangan lewatkan

VB NET - How To Add CheckBox Column To DataGridView In VB.NET
4/ 5
Oleh

Subscribe via email

Suka dengan artikel di atas? Tambahkan email Anda untuk berlangganan.