Visual Basic Concepts
Menu Title and Naming Guidelines
See Also
To maintain consistency with other applications, it's a good idea to follow established naming guidelines when creating menus.
Setting the Caption Property
When assigning captions for menu items, you should try to follow these guidelines:
- Item names should be unique within a menu, but may be repeated in different menus to represent similar actions.
- Item names may be single, compound, or multiple words.
- Each item name should have a unique mnemonic access character for users who choose commands with keyboards. The access character should be the first letter of the menu title, unless another letter offers a stronger mnemonic link; no two menu titles should use the same access character. For more information about assigning access and shortcut keys, see "Creating Menus with the Menu Editor" earlier in this chapter.
- An ellipsis (…) should follow names of commands that require more information before they can be completed, such as commands that display a dialog (Save As…, Preferences…).
- Keep the item names short. If you are localizing your application, the length of words tends to increase approximately thirty percent in foreign versions, and you may not have enough space to adequately list all of your menu items. For more details on localizing your application, see "International Issues."
Menu Naming Conventions
To make your code more readable and easier to maintain, it's a good idea to follow established naming conventions when setting the Name property in the Menu Editor. Most naming convention guidelines suggest a prefix to identify the object (that is, mnu for a menu control) followed by the name of the top-level menu (for example, File). For submenus, this would be followed by the caption of the submenu (for example, mnuFileOpen).
For More Information For an example of suggested naming conventions, see "Visual Basic Coding Conventions."