Solved

Context menu when user right-clicks on row of datagridview

Posted on 2006-11-01
6
4,491 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
  • 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

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 …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

773 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