Can't Use Multiple & (for Access Keys) in a VB Menu Control

ID Number: Q73372

1.00

WINDOWS

Summary:

When creating a menu control that has multiple & (ampersand)

characters to mark the access keys in the caption (for example,

&a&b&c&d), the menu will appear with an underline under the character

after the last &. However, the access key will respond to the

character following the first &. This is not a problem with Visual

Basic, but rather with the Windows operating environment.

This information applies to the Microsoft Visual Basic programming

system version 1.0 for Windows.

To work around this problem, do not put multiple & characters in the

menu caption; just use one & character per caption.

More Information:

Steps to Reproduce Problem

--------------------------

1. From the File menu, choose New Project (ALT+F+N).

2. From the Window menu, choose Menu Design Window (ALT+W+M).

3. Enter "&A&B&C&D" (without the quotation marks) for the Caption.

4. Enter "ABCD" (without the quotation marks) for the CtlName.

5. Choose the Done button.

6. Click on the menu item ABCD on Form1.

7. Enter the statement Print "ABCD" in the click event for the menu

item ABCD as follows:

Sub ABCD_Click ()

Print "ABCD"

End Sub

8. Run the program.

When the program is run, the D in the menu caption will be underlined,

but the menu responds to ALT+A, not ALT+D.