context menu question

S

Starbuck

Hi

I have a contextm enu on a form and called it - jobMenu and this is linked
to a datagrid
When the right mouse button is clicked the following code is called and the
menu displayed.

private void jobMenu_Popup(object sender, System.EventArgs e)

{

MenuItem menuItem1 = new MenuItem("Edit");

MenuItem menuItem2 = new MenuItem("Delete");

// Clear all previously added MenuItems.

jobMenu.MenuItems.Clear();

jobMenu.MenuItems.Add(menuItem1);

jobMenu.MenuItems.Add(menuItem2);

}



I cannot figure out what I do next, how do I call procedures when clicking
on the popup menu options,



Thanks in advance
 
T

Thomas P. Skinner [MVP]

You need to set up event handlers for each menu item. If you use VS.NET this
is very simple, just double click on the menu item in the designer.

Thomas P. Skinner [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top