• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 348
  • Last Modified:

how to select row when user checks checkbox

I have a DataGridView and in this I have unbound check box column.
now I need that when user checks any of the chechboxes in the grid then it should select the row as well .

currently I am using this code but it does not seem to be working

#Region "drgProperty_CurrentCellDirtyStateChanged"
    Private Sub drgProperty_CurrentCellDirtyStateChanged(sender As System.Object, e As System.EventArgs) Handles drgProperty.CurrentCellDirtyStateChanged
    End Sub
#End Region

#Region "drgProperty_CellValueChanged"
    Private Sub drgProperty_CellValueChanged(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles drgProperty.CellValueChanged
        If Me.drgProperty.CurrentRow IsNot Nothing Then
            If Convert.ToBoolean(Me.drgProperty.CurrentRow.Cells(0).Value) Then
                Me.drgProperty.CurrentRow.Selected = True
                Me.drgProperty.CurrentRow.Selected = False
            End If
        End If

    End Sub
#End Region
1 Solution
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now