under this event

Private Sub dgSO_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgSO.CellContentClick

if user click the checkbox in datagridview, a window pops up and ask data
when user press escape (no data input), the popup form will dispose and the checkbox should be unchecked
This code doesn't work

dgSO.CurrentRow.Cells(14).Value = False

I also tried this

Dim chk As DataGridViewCheckBoxCell = CType(dgSO.Rows(e.RowIndex).Cells(14), DataGridViewCheckBoxCell)
        chk.Value = 0 (or false)
2 Years
Discussion Span
Last Post by Shark_1

Well just looked around within this site and found a similar post which already has an answer to this question. This question is a duplicate.

Edited by Mr.M: Adding link


You can try it

Private Sub dgSO_CellContentClick(sender As Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgSO.CellContentClick
        If TypeOf dgSO.CurrentCell.OwningColumn Is DataGridViewCheckBoxColumn Then

            Dim chkcell As DataGridViewCheckBoxCell = CType(dgSO.CurrentCell, DataGridViewCheckBoxCell)

            If chkcell.EditingCellValueChanged Then
                If chkcell.EditingCellFormattedValue = True Then

                    Dim x As String
                    x = InputBox("please input a value.")
                    If x = Nothing Then
                        chkcell.EditingCellFormattedValue = False
                    End If
                End If
            End If

        End If
    End Sub

But to get result you must have to remove the event handler dgSO_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs).

Edited by Shark_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.