[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4569
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

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!

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