Microsoft KB Archive/843329

= 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 =

Article ID: 843329

Article Last Modified on 4/3/2007

-

APPLIES TO


 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Standard Edition
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
 * Microsoft Windows XP Professional
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Professional Edition

-





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.
 * 1) On the Appearance tab, click Effects. The Effects dialog box appears.
 * 2) 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:

http://msdn2.microsoft.com/en-us/library/ms724947.aspx



STATUS
This behavior is by design.



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#.
 * 1) Under Templates, click Windows Application.
 * 2) Type TestApp in the Name box, and then click OK. By default, a form that is named Form1 is created.
 * 3) Add a Button control to the Form1 form, and then press F4.
 * 4) Locate the Text property, type &button1, and then press ENTER.
 * 5) On the Build menu, click Build Solution.
 * 6) On the Debug menu, click Start to run the project.

You will notice the behavior that is mentioned in the &quot;Symptoms&quot; section.

