Assign the same click event to each menu option, then in the handler use the
name to determine which was clicked.
ie.
public void AllMenuOptions_Clicked(object sender, ...)
{
switch( ((Control)sender).Name).ToString())
{
case "mnuFile":
<whatever>
break;
case "mnuEdit":
<whatever>
break;
}
}
You can do more funky stuff with reflection but thats a different story.
"Nikki" <ap*********@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
Hi,
I m developing a Windows application in which i want to create a
context menu, having variable number of submenus depending on the the
list in the file. I m able to create these submenus at runtime by
reading the file. But the problem is that there is no fixed count of
submenus and becaz of that i m not able to figure out "How to create
click event handler dynamically for each submenuitem"? Please help.
Thanks,
Nikki