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.

Handling Clicks

Incase you don't know how control arrays work; all three of my favorites above will have the same event procedure associated with them. So in my example above the mnuFavLinks_Click event would fire for all three Favorites, and the only way to tell them apart is to check their index, which gets passed into the event procedure. The example below will show you what I mean. All it does is when you click on one of the favorites, a message box will appear telling you its index and its caption.

Private Sub mnuFavLinks_Click(Index As Integer)



	MsgBox Index & ": " & mnuFavLinks(Index).Caption



End Sub

<<Previous | Download Code >>

Contents

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

Main VB Page
Back to Tutorials

Search For More Tutorials

Google