Link to home
Start Free TrialLog in
Avatar of tonelm54
tonelm54

asked on

Datagrid selection change on mouseove

Does anyone know how to change the currently selected row of a datagrid, as the mouse moves over that row?

Ive been trying to write a program that Id like to change the row selected as the mouse moves over it, but cant figure out how method sends which row the mouse is currently over.

Any ideas?
Private Sub DataGridView1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseMove

    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of nordtorp
nordtorp
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tonelm54
tonelm54

ASKER

Thank you
Private Sub DataGridView1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridView1.MouseMove
        If DataGridView1.HitTest(e.X, e.Y).RowIndex >= 0 Then
            DataGridView1.Rows(DataGridView1.HitTest(e.X, e.Y).RowIndex).Selected = True
        End If
    End Sub

Open in new window