0

I have been trying to find out how to setup a popup menu in Visual Studio Community 2015. I want the popup menu to work/appear when I right click on a datagrid in a database application that I'm writing.

I've searched online and so far I've only found an MSDN page that seems to cover how this is done:

https://msdn.microsoft.com/en-us/library/k5az22fk.aspx

However, the instructions on that page tell me to create a standard menu, without a 'caption' in the header for the menu. Also the actual instructions for actually creating a menu tell me to do the following:

From the View menu, click on Resource View and then right-click on the Menu heading and choose Add Resource. Choose Menu.

Those instructions can be found on the following page:

https://msdn.microsoft.com/en-us/library/4b6tafew.aspx

The problem I have is that the instructions (as given above) tell me to click on the 'view' menu and then click on 'Resource View', etc. This is when there is no 'Resource View' in the 'View' menu in Visual Studio Community 2015.

Therefore, is this something that I simply can't do in Visual Studio Community 2015, or is there an alternative way of setting up the popup menu in that version of the tool.

Panagiotis Kanavos
  • 120,703
  • 13
  • 188
  • 236
craig-c
  • 161
  • 2
  • 5
  • First, the link is irrelevant - it's about creating a resource, *not* actually creating a menu. Second, it's called a Context menu. All menus are popup. Third, the version of VS is also irrelevant - context menus are created by the framework and your code, not VS. Finally - what type of application are you trying to create? I expect you aren't trying to create a web application, but Windows Forms uses different mechanisms to display popup menus from WPF. In both cases though you'll find tutorials and examples, provided you search for the *correct* terms – Panagiotis Kanavos Dec 08 '15 at 14:47
  • Possible duplicate of [right click context menu for datagridview](http://stackoverflow.com/questions/1718389/right-click-context-menu-for-datagridview) – Panagiotis Kanavos Dec 08 '15 at 14:48
  • I'm just creating a regular desktop database application that connects to a MySQL database. It isn't a web application at all, so no ASP.net being used anywhere. – craig-c Dec 09 '15 at 15:20
  • Also, I've searched online quite a lot for info on creating what I need (a popup menu that appears when I right click on a row in the datagrid), but so far all I've found is the pages/links that I've given above. You say I need to search using the correct terms. if that's the case, what are the terms I need to use in a search?? – craig-c Dec 09 '15 at 15:23
  • First, I already posted a link to a duplicat question. Second, it's called a **context** menu, not a popup menu. Third, there are no "regular" desktop applications - there are Windows Forms applications or WPF applications. The classes involved are different but in both cases, you need to look for **Context Menus** – Panagiotis Kanavos Dec 10 '15 at 15:24
  • OK, thank you for your comments. I had actually found the page that you say my question is a duplicate of (obviously after I posted my question), so I have been aware of it, etc, for a while now. I haven't actually tried using what's in that page in my code yet, because I've been too busy with other work. I'll try that at some point soon. It currently looks like this page can be taken down, so I'll look into doing that as well. – craig-c Dec 11 '15 at 16:53
  • I can't get the code in that other page to work. The if condition shown in that bit of code simply won't work in VS 2015 (I just get errors in that line, if i try setting it up). Also, I can't add menu items to a context menu in the way shown. the 'Add' function doesn't seem to exist for a ContextMenu when I try setting it up. – craig-c Dec 12 '15 at 21:37

0 Answers0