Solved

Right click on data grid cell on vib net

Posted on 2010-11-18
5
279 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Suggested Solutions

Title # Comments Views Activity
Generate Unique ID in VB.NET 21 135
Visual Studio hangs on running project 6 84
Asp.Net Session Question 2 49
Add Combobox column to datagridview using vb.net 2 42
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 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