Link to home
Start Free TrialLog in
Avatar of ioustinos_sarris
ioustinos_sarrisFlag for Greece

asked on

Right click on data grid cell on vib net

I have a function in order to handle some clicks on my datagrid view.
However i want to be able to handle right clicks as well and show a button at the position of the click. Somehow like the know "what's this" button that some windows applications have.

How can i do that?

This is my function's declaration
Private Sub usersGrid_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles usersGrid.CellContentClick
Avatar of Erick37
Erick37
Flag of United States of America image

Right Clicks can be intercepted from the CellMouseDown event:

      Private Sub DataGridView1_CellMouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDown
            If e.Button = MouseButtons.Right Then
                                   ''do something
            End If
      End Sub
Use ContextMenuStrip on right click, here is a video tutorial:
http://www.youtube.com/watch?v=nCvJf83ocsE
Avatar of ioustinos_sarris

ASKER

I am using the usersGrid.CellContentClick so that i can capture the e.ColumnIndex attribute which i need.

In that manner i cannot have the e.Button attribute...
ASKER CERTIFIED SOLUTION
Avatar of Zhaolai
Zhaolai
Flag of United States of America 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