Current location - Recipe Complete Network - Complete cookbook of home-style dishes - What does the index in VB menu editor mean?
What does the index in VB menu editor mean?
Each menu control array element is identified by a unique index value, which is specified in the Index Property Box of the menu editor. When a control array member recognizes an event

Basic passes the value of its Index property as an additional parameter to the event procedure. The event procedure must include checking the index.

Property value code so that you can determine which control is being used.

For more information about control arrays, see Using Control Arrays in Standard Controls with Visual Basic.

To create an array of menu controls in the menu editor, follow these steps:

1. Select a form.

2. From the Tools menu, select Menu Editor.

-Or-

Click the Menu Editor button on the toolbar.

3. In the Title text box, type the text of the first menu title to be displayed in the menu bar.

The menu title text is displayed in the menu control list box.

4. In the Name text box, type the name that will be used to refer to the menu control in your code. Leave the index box blank.

5. At the next indentation level, create a menu item that will be the first element in the array by setting the title and name.

6. Set the index of the first element in the array to 0.

7. Create a second menu item at the same indentation level as the first menu item.

8. Set the name of the second element to be the same as the first element, and set its index to 1.

9. Repeat steps 5-8 for subsequent elements in the array.