Microsoft KB Archive/814353

= BUG: Menu shortcuts put &quot;D&quot; in front of numbers =

Article ID: 814353

Article Last Modified on 5/11/2007

-

APPLIES TO


 * Microsoft Visual Basic .NET 2003 Standard Edition
 * Microsoft Visual Basic .NET 2002 Standard Edition
 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual C# .NET 2002 Standard Edition

-



SYMPTOMS
When you set the shortcut keys for menu items such as CTRL+ or ALT+, the shortcut keys are displayed as CTRL+D or ALT+D at run time. However, you can access the menu items if you press CTRL+. For example, if you set CTRL+1 as a shortcut key for a menu item, the shortcut key is displayed as CTRL+D1 at run time, but you can access the menu item if you press CTRL+1.



CAUSE
The key enumeration specifies the key codes for the keyboard keys. In the key enumeration, the key names for numeric keys are prefixed with &quot;D&quot; (for example, D0, D1, D2, D3, and others). When the numeric keys are displayed in the menu items, the key names are converted to strings. The KeysConverter class converts the key values to strings, and then maps them to the respective numbers. The KeysConverter class cannot convert D0, D1, D2, D3, and others to 0, 1, 2, 3, and others. Therefore, the values are displayed as D0, D1, D2, D3, and others.



WORKAROUND
There is no workaround or resolution for this bug in Visual Studio .NET version 2003. This bug is fixed in later versions of Microsoft Visual Studio .NET. You can continue to access the menu items by pressing the shortcut keys and just ignore the &quot;D&quot; that is displayed before the number.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to Reproduce the Behavior
 Create a new Windows application by using Visual Basic .NET or Visual C# .NET.

By default, Form1 is created. From the toolbox, drag a MainMenu control onto Form1. Click Type Here, and then type Main in the menu.</li> Click Type Here below the Main menu. Type Item1, and then press the ENTER key.</li> Right-click Item1 under the Main menu, and then click Properties.</li> Select the Shortcut property in the Properties window, and then set the value to CTRL+1 .</li>  Double-click Item1, and then put the following code in the Code window:

Visual Basic .NET MessageBox.Show(&quot;Item1&quot;) Visual C# .NET MessageBox.Show(&quot;Item1&quot;); </li> On the Debug menu, click Start.</li> Click Main.

Notice the shortcut for the Item1 menu is displayed as CTRL+D1.</li> Press the CTRL+1 shortcut keys.

The message boxes are displayed.</li></ol>

Keywords: kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbmenu kbforms kbcontrol kbbug KB814353

-

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

© Microsoft Corporation. All rights reserved.