Add Menu Items Dynamically

  • Thread starter Thread starter Tom Bean
  • Start date Start date
T

Tom Bean

Is it possible to dynamically add items to a menu and use one event handler
for click events?

If so, how do you detect which of the new items was clicked?

Thanks,
Tom
 
Tom Bean wrote:
In the handling routine, you'll be passed an object. Cast this object to
a MenuItem. You can then use any number of properties to distinguish
between various MenuItems.

A personal favourite is to use the "Tag" property of a menu to store enough
information (such as a string) which is used to interpret the the menu
click. I usually use the Magic library for menus (www.dotnetmagic.com), but
I'm assuming that the standard .NET menus have this also (it's common to all
[Control]s as far as I know.

HTH

Tobin
 
Back
Top