How to Make a Drop Down Menu in Visual Basic
Software users are accustomed to accessing the features of software applications through a series of drop-down menu options. The drop-down design uses minimal screen real estate, since it displays the top level of your menu choices until they are needed. Clicking on a top-level option drops down a list of associated menu choices that roll back up once you make your selection. Adding a drop-down menu to a Visual Basic program is a straight-forward, visual process.
Instructions
-
-
1
Start Visual Basic by clicking "Start">All Programs>Microsoft Visual Studio>Microsoft Visual Studio."
-
2
Start a new project. Click "File>New>Project" to display the "New Project" dialog box. Select "Other Languages>Visual Basic>Windows" in the "Installed Templates" panel to use the Visual Basic (VB) Windows form template. Select "Windows Forms Application" and click "OK." Start your design in the empty form displayed.
-
-
3
Click the "Menu Strip" component in the "Toolbox" and drop it onto your form. Click "View>Toolbox" or press "Ctrl+Alt+X" if the Toolbox panel is not visible. Locate the Menu Strip in the "Menus and Toolbars" section.
-
4
Build the menu hierarchy by responding to the visual prompts on the toolbar. Type your first menu element in the text box that says "Type Here." Type "File," since that is traditionally the leftmost menu item. Add an access-key combination to the menu item. Type an ampersand before the letter you want to function as the hotkey, or keyboard shortcut key (see "Tips").
-
5
Add the remaining menu elements at the prompts, which appear to the right and bottom of the element just added. Type a hyphen where you want to draw a separator on the menu (see "Tips").
-
6
Compile the program by pressing "F7" or clicking "Build>Build Solution." Test your menu to ensure it works as designed.
-
1
Tips & Warnings
A common feature of menus is the use of quick-access key combinations, or hotkeys. These are keyboard shortcuts that allow you to interact with the menu without using a mouse. For example, typing "&File" will assign the "Alt-F" stroke to the menu, enabling you to press the "Alt" and "F" keys at the same time to access that menu option.
Separator lines--graphic lines inserted between groups of menu options--are helpful features that make drop-down menus easier to read.