Solved

Context menu when user right-clicks on row of datagridview

Posted on 2006-11-01
6
4,510 Views
Last Modified: 2007-12-19
I would like to to know how to go about creating a context menu for a datagridview when the user right-clicks on a row.

I have dragged a ContextMenuStrip from the toolbox and dropped it onto my datagridview and have added a few items.

When I run my application a context menu doesn't appear when I right-click on a populated datagridview row.

Do I need to utilize a datagridview event to make it work?

What do I need to know?

Thanks

Steve
0
Comment
Question by:Stephen_Perrett
[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
  • 3
  • 2
6 Comments
 
LVL 13

Accepted Solution

by:
newyuppie earned 500 total points
ID: 17854419
you need to set the ContextMenu property of the DataGridView to your created ContextMenuStrip.
0
 
LVL 13

Expert Comment

by:newyuppie
ID: 17854425
you can do it in the Designer, no need to do it by code.
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17854449
Or

        Dim toolTip As ToolTip = New System.Windows.Forms.ToolTip()
        toolTip.SetToolTip([Your datagridview], "This is the tooltip text")
        toolTip.Active = True

This way you can change the text for individual columns .. on the CellMouseEnter event.
0
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 
LVL 13

Expert Comment

by:newyuppie
ID: 17854460
hi kinger, the datagridview columns all have a tooltip property so you wouldnt need to handle it on any event
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17854483
lol, never spotted that .. ;)
0
 
LVL 11

Author Comment

by:Stephen_Perrett
ID: 17854504
Thanks newyuppie for getting me on the right track. Much simpler than I was beginning to imagine.

Also thanks to Kinger247 for your input also.

Steve

0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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