how to add items to main menu...

  • Thread starter Thread starter Bad_Kid
  • Start date Start date
B

Bad_Kid

dynamicly, during the program execution - for example - if I press a
utton - to add MenuItem - "aaaaa" into the &File column, after Save and
before Save As? - and how to remove it as well?
 
You need to get the main menu object which will contain a collection of
menuitems which will be your menus across the top of the screen.
Each menuitem contains a collection of menuitems which will be the menus
under that menu.
You can add to that collection at any index.

The following sample presumes you have a mainmenu with a menuitem calle
mnifile
//get the file menu

MenuItem FileMenu = this.mniFile;

//create a new menuitem

MenuItem NewItem = new MenuItem("NewItem");

//add the new menuitem at position 2 (will be third in the list)

FileMenu.MenuItems.Add(2, NewItem);



HTH

JB
 
Back
Top