| Menus are features that are available
in nearly all programs nowadays .
Making menus is very easy in Visual
Basic using the menu editor .
To start the menu editor you go to
Tools | Menu Editor or pressing Ctrl
and e achieves the same results .
The menu editor now appears , here
is what is displayed on screen.

Here is a run down of the important
features
Caption : this is the name
that the user will see
Name : this is the name that
the programmer uses , we use the mnu
prefix for all menu items (mnuFile)
Shortcut : this assigns a shortcut
to a menu item this is a combination
of keys which access a menu item for
example Ctrl + c is commonly used
for copy
Checked : this allows the programmer
to place a check beside a menu item
, this is unchecked by default
Enabled : This specifies whether
the menu item is accessible to the
user , if this is checked the menu
item is grayed out and inaccessible.
Visible: this determines whether
the menu item is visible if this is
not checked then the menu item will
not appear at run time.
WindowList : determines whether
the menu item applies to an MDI document
(Word and Excel are examples of MDI
applications)
HelpContextID : this matches
a help description if you have any
in your program
Index : this specifies a menus
index in a control array.
You will also have noticed the arrows
these are used to manipulate manu
items the up and down arrows move
the menu items up and down the list
and the left / right arrows are used
to indent the menu items.
Now we will create a simple menu
.
- In the caption box type &File
- In the name box type mnuFile
- click on the next button the blue
bar moves down ready for the next
item to be entered
- Click the right arrow button
- In the caption type -
- In the Name box type mnuSeperator
- press the next button
- In the caption box type &Exit
- in the name box type mnuFileExit
- click on OK
Your menu editor should look like
this at stage 10

Ok now to add code to make the exit
menu item function , open up the code
window and locate the mnuFileExit
click procedure and enter in it
Unload Me
Test and run your program , you have
just created your first menu.
|