Menus Property (AForm)

Returns a reference to a menu object as specified by a given menu name or index.

Syntax

 [ pMenu = ] Object.Menus ( vKey )

The Menus property syntax has the following parts:

 

Name

Type

Description

Object

AForm

AForm object

vKey

Val Variant

The given menu name (string) or index (number).

pMenu

AMenu

The menu returned on the AForm object.

Comments

This property can be set at design time and is read-only at run time.

When passing vKey an index use a zero base number When passing a string the Name is the menu item Name string property.  

The Menu property is similar to the Controls property on the Form object, and is accessed in a similar manner. For example, use the following code gray out the "FileOpen"menu item in the form:

Form.Menus(1).Find("FileOpen").Grayed=True

Example

The following statement sets the second menu to the current form menu bar:

MenuBar=Menus(1)

The following statement displays the second menu in the Form (usually as a result of a right click on the form):

PopupMenu(Menus(1))

Applies to

AForm

See Also

AMenu, Find, MenuBar, Menus, MenusCount