I have this gridview named "_oGvInstalled" and the user must check only 1 checkbox per row.

If _oGvInstalled.CurrentRow.Cells(0).Value = True Then
            _oGvInstalled.CurrentRow.Cells(1).Value = False
        ElseIf _oGvInstalled.CurrentRow.Cells(1).Value = True Then
            _oGvInstalled.CurrentRow.Cells(0).Value = False
        End If

If the user checked the first checkbox and the user checked the 2nd box, the first box must be unchecked.

1 Answers

0
PaulvdElst On

Implement oGvInstalled_CellContentClick event handler, like:

    Private Sub oGvInstalled_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles oGvInstalled.CellContentClick
        If e.RowIndex > -1 Then 'don't process the header row
            If oGvInstalled.Rows(e.RowIndex).Cells(e.ColumnIndex).Value = False Then
                ' checkbox is to be checked
                If e.ColumnIndex = 0 Then
                    oGvInstalled.Rows(e.RowIndex).Cells(1).Value = False
                Else
                    oGvInstalled.Rows(e.RowIndex).Cells(0).Value = False
                End If
            End If
        End If
    End Sub

Regards, Paul