Menus

Creating menu items

To create a menu item (i.e. Open, on the File Menu), use the following steps:

1) Select Tools | Menu Editor

2) Click the item on the list after the menu you want this item to go on. (i.e. after File). If there is an item already there, click Insert:

3) Enter the text to be displayed for the menu item in the Caption text box (i.e. Open). As always you can use the & to set the Shortcut key: So &Open would display the menu item Open and could be accessed by Alt+O when the File menu is open

4) Enter a name for the menu item. This will be used when accessing the menu's properties in your code.

5) Press the > button once. You will see four dots (....) appear before the text Open. This shows that Open is a item on the menu File:

6) Click OK. If you have used the examples, you will now see something like this when you click on File:

6) To write some code that runs when a menu item is clicked, simply click the menu item during design time. A code window will open with a new procedure. Enter any code you want to run when the menu item is clicked here.

You might also like...

Comments

About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor