Solved

Right click on data grid cell on vib net

Posted on 2010-11-18
5
262 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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 …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now