How to add menus at runtime



I just downloaded Google Pack. It has a bunch of sweet free tools to make windows better and to help with development - all made by google.

Design Time

So, how do you create a menu control array at design time? Simple,

  • First right click any place on your form where there are no controls.
  • Then choose Menu Editor…
  • Now in the editor add a main menu,
  • Give it a caption such as Favorites and a name such as mnuFav.
  • Then click next,
  • Then the right arrow button so that the new menu will appear under it.
  • Now give this menu a fake caption for now like My Caption and give it a name such as mnuFavLinks.
  • Finally set its index property to 0. By setting its index property, you tell VB that you want this menu to be the first element in the control array.

That's all you have to do at design time.

<<Previous | Next>>

Contents

- Introduction
- Design Time
- Run Time
- Handle Clicks
- Download Code

Main VB Page
Back to Tutorials

Search For More Tutorials

Google