Mike Biccochi
March 24th, 1999, 08:42 PM
I would like to be able to right click on something and put choice in there for the user to pick. For instance, for a order entry program have the user right-click on an item have it bring up a box where they can choose to add or delete that item to their order.
Chris Eastwood
March 25th, 1999, 03:45 AM
Hi
You need to create a menu for your application / control / form / whatever.
In this case, call it mnuPopup, then add some other menu items below it.
Now on the control you want the menu to popup on, place code similar to the following in the controls_mouseup event :
eg:
Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
PopupMenu mnuPopup
End If
End Sub
Of course - you can make the root menu (mnuPopup) invisible, so that it doesn't appear on the form, but it's sub-items will be visible when you use the above code.
My VBCodeLibrary program at http://www.codeguru.com/vb/articles/1638.shtml demonstrates the use of popupmenus
Regards
Chris Eastwood
Codeguru - the website for developers
http://www.codeguru.com/vb
VBCodeLibrary Program