Solved

Right click on data grid cell on vib net

Posted on 2010-11-18
5
277 Views
Last Modified: 2012-05-10
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
0
Comment
Question by:ioustinos_sarris
5 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 34165584
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
 
LVL 17

Expert Comment

by:Zhaolai
ID: 34165618
Use ContextMenuStrip on right click, here is a video tutorial:
http://www.youtube.com/watch?v=nCvJf83ocsE
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34167231
0
 

Author Comment

by:ioustinos_sarris
ID: 34198671
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
 
LVL 17

Accepted Solution

by:
Zhaolai earned 500 total points
ID: 34199361
You can use CellMouseClick or CellMouseDown or CellMouseUp event to get BOTH e.ColumnIndex and e.Button attributes.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 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