Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 30,960 times

Contents

Related Categories

Menus - Creating menu items

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.

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments

  • help with the code

    Posted by minor on 28 Apr 2003

    In this tutorial i dosent tell you the code for the menu. and im also very new to vb so if someone could tell me what i need to do for the code that would be great.

  • VFlags variable not defined?

    Posted by planethax on 17 Nov 2002

    I have made a menu with1 1 Item (about) set it to enable - unchecked visable
    made a click event(msg box)

    then in my form mouse up event I put
    [code]
    Private Sub Form_MouseUp(Button As Integer, ...

  • Posted by James Crowley on 20 May 2002

    sorry 'bout that... there was an old style link lurking in there... I have corrected the link on

    http://www.developerfusion.com/show/15/10/, which now points to

    http://www.developerfusion.com/sh...

  • example

    Posted by Rollershade on 20 May 2002

    i click view an example and no example???
    i really want to change the look of my menu,change color or nything? ny ideas?