How-To... - Make a Popup Menu

Creating a popup menu in your Visual Basic program is very simple, just one line of code(within a IF statement). You usually put it in objects MouseDown procedure. First you need to create your menu using the Menu Editor. In my example, I have made the menu invisible at run-time. The code to make the menu popup is:-

If Button = vbRightButton Then PopupMenu Me.mnuPopup

If you want to use the left button for the menu to popup, use vbLeftButton instead of vbRightButton.

You can download the source code by clicking here


This site is Copyright © 1999 of David Cowan. VB How-To, Dodgesoft and DodgeSoft Productions is Copyright © 1999 of David Cowan. Source-code and programs are copyright of their respective owners. For a messageboard, click here