C# - How To Know If DataGridViewCheckBoxCell Is Checked In C#
In This VB.NET Tutorial We Will See How To Check If DataGridView CheckBox Cell Is Checked Or Not In VBNET Programming Language.
Project Source Code:
Public Class VB_DataGridView_CheckBoxCell_Checked
Private Sub VB_DataGridView_CheckBoxCell_Checked_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
Dim CheckBoxColumn As New DataGridViewCheckBoxColumn()
CheckBoxColumn.HeaderText = "Check Box Column"
DataGridView1.Columns.Add(CheckBoxColumn)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.Rows.Add(False)
DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
DataGridView1.AllowUserToAddRows = False
End Sub
Private Sub BtnCheckedCell_Click(sender As Object, e As EventArgs) Handles BtnCheckedCell.Click
For i As Integer = 0 To DataGridView1.Rows.Count() - 1
Dim c As Boolean
c = DataGridView1.Rows(i).Cells(0).Value
' if the checkbox cell is checked
If c = True Then
MessageBox.Show("Checked")
' if not
Else
MessageBox.Show("Not Checked")
End If
Next
End Sub
End Class
///////////////OUTPUT:
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :