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.

Run Time

Now, at runtime to add a new menu to the menu control array you simply use the command: Load mnuFavsLinks(index) where index is the next number in the control array. For example I want three favorites under my Favorites menu. I want them to show up as Favorite 1, Favorite 2, and Favorite 3. This is the code I would use in the form load event:

Private Sub Form_Load() 



	mnuFavLinks(0).caption = "Favorite 1" 



	Load mnuFavLinks(1) 



	Load mnuFavLinks(2) 



	MnuFavLinks(1).Caption = "Favorite 2" 



	mnuFavLinks(2).Caption = "Favorite 3" 



End Sub

<< Previous | Next >>

Contents

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

Main VB Page
Back to Tutorials

Search For More Tutorials

Google