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
ioustinos_sarrisAsked:
Who is Participating?
 
ZhaolaiConnect With a Mentor Commented:
You can use CellMouseClick or CellMouseDown or CellMouseUp event to get BOTH e.ColumnIndex and e.Button attributes.
0
 
Erick37Commented:
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
0
 
ZhaolaiCommented:
Use ContextMenuStrip on right click, here is a video tutorial:
http://www.youtube.com/watch?v=nCvJf83ocsE
0
 
ioustinos_sarrisAuthor Commented:
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...
0
All Courses

From novice to tech pro — start learning today.