Link to home
Start Free TrialLog in
Avatar of Dov_B
Dov_B

asked on

on a mouse down in a datagridview cell how can I get both the e.columnindex and the mouse button at the same time

on a mouse down on a datgridview I need to know 2 things
which cell was mouse downed
which butoon did he mouse down with (right, or left)

I have been trying differnt datagridview events but they do one or the other but not both
when I try combining them it does not work

vb.net 2008 express
Avatar of zoidi
zoidi
Flag of Luxembourg image

Hi,

you could do this on the MouseDown Event:
Private Sub dgvAudio_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dgvAudio.MouseDown
        Dim intRowIndex as Integer = DataGridView1.HitTest(e.X, e.Y).RowIndex
        Dim intColumn as Integer = DataGridView1.HitTest(e.X, e.Y).ColumnIndex
        Dim Button As Windows.Forms.MouseButtons = e.Button
End Sub
 
 
         

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of zoidi
zoidi
Flag of Luxembourg 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