Adding a menu bar to your program.

This file was modified on 13 December 2004 .

NOTE: This is general information and will probably need to be modified for your program.

Create a new VB project.

Expand the form.

Click Tools, then Menu Editor.  Menu editor can be accessed by clicking [Tools] in the menu bar, then selecting [Menu editor], or by clicking the icon for Menu editor in the Toolbar, not the Toolbox.  The shortcut to open the Menu editor is to press the [Ctrl] key at the same time as the [E] key, which is also written as Ctrl + E.

The menu editor window, when opened, looks like this.

NOTE: The "&" symbol does not need to be used.  It is used in front of a letter if you wish that letter to become a hotkey.  The '&' sign will not show when you run your program.  It will just put an underline under the letter that follows the '&' sign, which indicates that that letter is the hotkey.

In top line type "File" or type "&File" and in second line type mnu_file  This is the name.  Use the prefix mnu_ so that the sections of code for all the menu items will be located in close proximity to each other in the code section.

Click next then in the top line type &Exit and then in the next line mnu_exit

Click the right pointing arrow to move the exit over a few spaces.

You can add many things to your menu if you wish.

If your project needs or has several forms you could place the various form in the menu bar so that it becomes easy to change from one form to another.  On the new form you can add a menu item like "Go Back" so the user can return to the original form.  This could be useful for the standard "About" menu item that most programs use to inform you about copyright information and about the person who wrote the program.

This will create the menu items but you still need to insert the code for each menu item.

Return to the page whence you came by clicking the Back button on your internet browser.

 

---------------------------------------------------------------------------------------------------

Do not put an entry for print unless told to do so by the teacher.  With our networked printers we would have a mess.

 

Repeat the process for print.

Click here for some simple code to have the form print to the printer when the print button is pushed on the drop down menu.