BUG: Menu shortcuts put "D" in front of numbers (814353)



The information in this article applies to:

  • Microsoft Visual Basic .NET (2003)
  • Microsoft Visual Basic .NET (2002)
  • Microsoft Visual C# .NET (2003)
  • Microsoft Visual C# .NET (2002)

SYMPTOMS

When you set the shortcut keys for menu items such as CTRL+<Number> or ALT+<Number>, the shortcut keys are displayed as CTRL+D<Number> or ALT+D<Number> at run time. However, you can access the menu items if you press CTRL+<Number>. 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 "D" (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 "D" that is displayed before the number.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION


Steps to Reproduce the Behavior

  1. Create a new Windows application by using Visual Basic .NET or Visual C# .NET.

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

    Visual Basic .NET
    MessageBox.Show("Item1")
    Visual C# .NET
    MessageBox.Show("Item1");
  8. On the Debug menu, click Start.
  9. Click Main.

    Notice the shortcut for the Item1 menu is displayed as CTRL+D1.
  10. Press the CTRL+1 shortcut keys.

    The message boxes are displayed.

Modification Type:MinorLast Reviewed:2/3/2006
Keywords:kbvs2005swept kbvs2005doesnotapply kbvs2002sp1sweep kbMenu kbForms kbControl kbbug KB814353 kbAudDeveloper