The MainMenu (Main menu) control is the "menu editor" used by vb.net to replace the previous version of Visual Basic. The MainMenu control has a great advantage over the menu editor because it makes it easier for the application to use the entire menu as a control's "identity," and you can make multiple uses of different forms without having to redesign the menus for each form. The icon for the MainMenu control in the toolbox is as shown in the figure:
1. Add MainMenu controls at design time
Adding a MainMenu control is the same as adding other controls (double-clicking or dragging), but the MainMenu control itself does not exist on the form, but rather in the component tray below the form, as shown in the following illustration:
None of the controls here are present in the form, but its methods, procedures, properties affect the form and other controls on it, such as the timer control, the Helpprovide (Help provided) control, and so on.
2. Make Menu
Click the MainMenu control in the component tray, and then in the top left of the form, click Type here, change the title of the menu, as shown in the following illustration:
Right-click any of the top menu and select "Edit Names" (change name) from the pop-up menu, as shown in the following illustration:
When you click the submenu again, you can change the name of the menu. Click "Edit Names" for the third time to restore the normal menu editing status.
3. Menu click event
The most commonly used event in a menu is the click event, which, in general, always corresponds to the Click event of the button in the toolbar.