How to get the name of menuItem at runtime?

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

like this,
foreach (MenuItem item in this.mainMenu1.MenuItems)
{
//some code
//I want to get the menuitem's name here!

}
No name property found. please help!
 
Name is a DesignTime Only property for MenuItem.
Derive from MenuItem and use that instead or use a hashtable.

I have simplified the hashtable method by using an extender. The vb.net code
for this can be found on my site, dotnetrix.co.uk -->Tips-->Menus.
Create the component and drop it on the form. All menuitems will be extended
with a Tag property which you can set to a unique value.
 
Back
Top