I have 2 checkboxes in a datagridview
I added this code

Private Sub dgSO_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgSO.CurrentCellDirtyStateChanged
        If dgSO.IsCurrentCellDirty Then
        End If
    End Sub

and when user click the checkbox, i used this code

Private Sub dgSO_CellContentClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgSO.CellContentClick
        If dgSO.CurrentRow.Cells("Notching").Value = True Then
            Exit Sub
        ElseIf dgSO.CurrentRow.Cells("Arc-Edge").Value = True Then
            Exit Sub

        End If

    End Sub

the problem is when I click the arc edge and the notching is currently checked, it still shows the MsgBox("notching") since it detected that it is checked

how will i do the approach that only shows the message of the checkbox that is checked by user?


You can try it

 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
                End If
            End If

 End If


Thanks for the reply. I tried your code under cellcontentclick but nothing happened. no message showed.
One thing more, How about there will be different actions for each checkbox, in your code how will I specify which checkbox will do the specific operation?

I tried changing this

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


Dim chknotch As DataGridViewCheckBoxCell = CType(dgSO.CurrentRow.Cells("Notching"), DataGridViewCheckBoxCell)

still no luck

You must have to remove this event handler dgSO.CurrentCellDirtyStateChangedto get result.