Working with Popup Menu (Context Menu) in VB.NET


A PopUp menu is a menu that is displayed when user right click either on a form or on a control.
It is also known as Context Menu or Floating Menu.
PopUp menu is useful to represents list of commonly used commands for form or control.
It is displayed independent of the menu strip. It display at the position where right button of the mouse is clicked by user.
Different controls and forms having different Pop up menu as per their requirements.
In order to create a PopUp menu double click on the ContextMenuStrip control in the Tool Box as shown below:
ContextMenu
As you double click on ContextMenuStrip control a PopUp menu is added just under the title bar or menu strip of the form and ContextMenuStrip is added in the component tray under the form as shown below:

     
ContextMenu
As shown in the figure a PopUp menu is added just under the title bar of the form or Menu Bar but it does not display at the same position during run time. It display at the position where user click right button of the mouse.
User can add as many PopUp menus as required and assign them to different controls placed on the form or to the form itself. In order to assign PopUp menu to particular control user have to set ContextMenuStrip property of that control.
PopUp menu is shown in the figure below:
ContextMenu

Download Projects


Download Programs