The letter key is not underlined on a button control when you create a keyboard shortcut by using Visual Studio .NET or Visual Studio 2005 (843329)



The information in this article applies to:

  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition
  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition
  • Microsoft Windows Server 2003, Enterprise Edition
  • Microsoft Windows XP Professional
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Professional

Important This article contains information about how to modify the registry. Make sure to back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows registry

SYMPTOMS

If you create a button control on a Microsoft Windows Form, and you specify a keyboard shortcut for the button control, the letter key that you specified may not be underlined on the button control when you view the form.

CAUSE

This property has been changed in Microsoft Windows Server 2003, Microsoft Windows XP, and Microsoft Windows 2000. This is a new feature. These operating systems disable the underline format for the letter key in a keyboard shortcut until you press ALT. When you press ALT, you will notice that the letter key appears correctly.

RESOLUTION

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To change this behavior, use one of the following methods:

Change the Windows desktop properties

  1. Right-click the Windows desktop, and then click Properties. The Display Properties dialog box appears.
  2. Click the Appearance tab.

    Note In Windows 2000, click the Effects tab.
  3. On the Appearance tab, click Effects. The Effects dialog box appears.
  4. Click to clear the Hide underlined letters for keyboard navigation until I press the Alt key check box, and then click OK.

    Note In Windows 2000, click to clear the Hide keyboard navigation indicators until I use the Alt key check box, and then click OK.

Change the setting programmatically

Note This method is the preferred method to work around this problem.

To change the setting programatically, call the SystemParametersInfo function with the SPI_SETKEYBOARDCUES flag and the pvParam parameter set to TRUE. For more information about the SystemParametersInfo function, visit the following Microsoft Developer Network (MSDN) Web site:

STATUS

This behavior is by design.

MORE INFORMATION

Steps to reproduce the behavior

  1. On a computer that is running Windows XP, start Microsoft Visual Studio .NET or Microsoft Visual Studio 2005.
  2. On the File menu, point to New, and then click Project. The New Project dialog box appears.
  3. Under Project Types, click Visual C# Projects.

    Note In Visual Studio 2005, click Visual C#.
  4. Under Templates, click Windows Application.
  5. Type TestApp in the Name box, and then click OK. By default, a form that is named Form1 is created.
  6. Add a Button control to the Form1 form, and then press F4.
  7. Locate the Text property, type &button1, and then press ENTER.
  8. On the Build menu, click Build Solution.
  9. On the Debug menu, click Start to run the project.
You will notice the behavior that is mentioned in the "Symptoms" section.

Modification Type:MajorLast Reviewed:2/28/2006
Keywords:kbvs2005swept kbvs2005applies kbWindowsForms kbRegistry kbForms kbButton kbsettings kbProperties kbprb KB843329 kbAudDeveloper