Microsoft KB Archive/73372

= PRB: Can't Use Multiple & (for Access Keys) in VB Menu Control =

Article ID: 73372

Article Last Modified on 12/12/2003

-

APPLIES TO


 * Microsoft Visual Basic 2.0 Standard Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 2.0 Professional Edition
 * Microsoft Visual Basic 3.0 Professional Edition
 * Microsoft Visual Basic 1.0 Standard Edition

-



This article was previously published under Q73372



SYMPTOMS
When creating a menu control that uses 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 &.



WORKAROUND
Use a single ampersand character per caption.



STATUS
This behavior is by design in the Windows operating environment.



Steps to Reproduce Behavior
 From the File menu, choose New Project (ALT+F+N). From the Window menu, choose Menu Design Window (ALT+W+M). Enter &A&B&C&D for the Caption. Enter ABCD for the CtlName. Choose the Done button. Click the menu item ABCD on Form1.</li>  Enter the statement Print &quot;ABCD&quot; in the click event for the menu item ABCD as follows: Sub ABCD_Click Print &quot;ABCD&quot; End Sub </li> Run the program.</li></ol>

When the program is run, the D in the menu caption will be underlined, but the menu responds to ALT+A, not ALT+D.

Additional query words: 2.00 3.00

Keywords: kbprb KB73372

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.