?
Solved

Datagrid selection change on mouseove

Posted on 2009-12-26
2
Medium Priority
?
172 Views
Last Modified: 2012-06-21
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

0
Comment
Question by:tonelm54
2 Comments
 
LVL 11

Accepted Solution

by:
nordtorp earned 2000 total points
ID: 26125868
Please see this question on EE. It is in C Sharp, but you should get the logic of it, though.

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_23226420.html
0
 

Author Comment

by:tonelm54
ID: 26125890
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

0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Screencast - Getting to Know the Pipeline
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question