I added a checkbox and a new column to the datagridview. The checkbox is being checked automatically when adding data to this column. If we delete this data thinking it is not necessary The checkbox is still checked. I mean, once I give the data, the checkbox must be checked, but if I remove this data, how to unchecked the automatic checkbox Goes. I am making this effort on VB.net. Thanks in advance to the experienced collaborators.
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim checkboxcolumn As New DataGridViewCheckBoxColumn() checkboxcolumn.HeaderText = "*" checkboxcolumn.Width = 20 checkboxcolumn.Name = "checkboxcolomn" DataGridView1.Columns.Insert(0, checkboxcolumn) End Sub Sub display_data() Dim cmd As New SqlCommand("select * from tbl_Pro", con) Dim da As New SqlDataAdapter(cmd) Dim dt As New DataTable dt.Clear() da.Fill(dt) DataGridView1.DataSource = dt dt.Columns.Add("Qty") End Sub Private Sub DataGridView1_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged Dim cell1 As DataGridViewCheckBoxCell = DataGridView1.Rows(e.RowIndex).Cells(0) cell1.Value = True End Sub
datagridviewXY.rows(1..n).cells("WithCheckbox").value = false
datagridviewXY.rows(1..n).cells("WithCheckbox").value = true
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)