Creating Context Menus in Visual Basic
Visual basic Context menus are the menus that pop up when the user clicks with the right hand mouse button over a control or area in a form. They are called context menus because the menu is usually specific to the object over which the mouse was clicked. Context menus are also sometimes referred to as Popup menus or Shortcut menus.
This chapter will provide an overview of the steps necessary to create and programme Context menus in Visual Basic. For information on creating Top-level menus see the Creating Top-Level Menus in Visual Basic chapter of this book.
Adding Context Menus to a Visual Basic Form
Context menus are added to a form in Visual Basic using the Context Menu Strip object and associating it with a particular control. Begin by creating a new Windows Application project in Visual Studio. Next, add a RichTextBox component to the form so that the form appears as follows: