DatagridviewCheckboxColumn

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • OuTCasT
    Contributor
    • Jan 2008
    • 374

    DatagridviewCheckboxColumn

    Hi, i have a checkbox column in a datagridview. when i select it i want that rows data to move into a listbox.
    i did that like this
    Code:
    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
            If DataGridView1.CurrentRow.Cells(0).Selected = True Then
                ListBox1.Items.Add(DataGridView1.CurrentRow.Cells(1).Value.ToString())
                       End If
        End Sub
    now it add the cell information to the listbox, what i want to do now is if they uncheck that column that they have already checked then it must remove the corresponding data from the listbox.

    is this possible ?
  • OuTCasT
    Contributor
    • Jan 2008
    • 374

    #2
    If DataGridView2.C urrentRow.Cells (0).Selected = True Then
    Dim dgCB As New DataGridViewChe ckBoxCell
    Dim blnchecked As Boolean
    dgCB = CType(DataGridV iew2("Select Category", e.RowIndex), DataGridViewChe ckBoxCell)
    If dgCB.EditedForm attedValue Then
    blnchecked = True
    Else
    blnchecked = False
    End If

    Comment

    Working...