Menu Controls

  • A menu control provides a list of options to the user to choose from. It hides these options when they are not needed and thus saves the space in the Windows application.
  • Here we are going to study about a menu control i.e MenuStrip control :

MenuStrip Control

MenuStrip Control is used to display menus in a Windows Application. Let us take an example of MenuStrip control:

Example
  • Add the MenuStrip control from the ToolBox to Form.
  • Now notice the text Type Here. We can create a new menu by double-clicking on that text. A text box will appear in place of text Type Here. Now enter the title for the menu as ‘File’.
  • Now we will add the menu items to File Menu. To do this, click on the Type Here text box below the File menu. This will open a Text box. Enter the text ‘New’ for menu item.
  • Similarly we can add multiple menu items for File menu as Open, Save and Exit. As shown in given figure:
  • menu-control
  • Press F5 key to see the result. It will show the following output:
  • menu-control

If we click on any of these items, these will do nothing. We have to describe the actions for these menu items so that that they can perform any work.