• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4578
  • Last Modified:

Context menu when user right-clicks on row of datagridview

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
Stephen_Perrett
Asked:
Stephen_Perrett
  • 3
  • 2
1 Solution
 
newyuppieCommented:
you need to set the ContextMenu property of the DataGridView to your created ContextMenuStrip.
0
 
newyuppieCommented:
you can do it in the Designer, no need to do it by code.
0
 
Kinger247Commented:
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
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
newyuppieCommented:
hi kinger, the datagridview columns all have a tooltip property so you wouldnt need to handle it on any event
0
 
Kinger247Commented:
lol, never spotted that .. ;)
0
 
Stephen_PerrettAuthor Commented:
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

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now