Popup menu

hp76

New member
Joined
Apr 4, 2005
Messages
2
Programming Experience
3-5
How do I create a Popup menu from a vb.net button control.
E.g. If a user clicked on the 'New' button a menu would popup giving two options - 'Clear Window' and 'New Contact'.

Thanks
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,328
Location
Sydney, Australia
Programming Experience
10+
Add a ContextMenu to your form containing the options required. In the button's Click event handler enter the following line:

Me.ContextMenu1.Show(Me.Button1, New Point(0, Me.Button1.Size.Height))

The menu will popup directly below your button. You can then handle the options exactly as you would for a MainMenu.
 
Top Bottom