Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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 (http://support.microsoft.com/kb/256986/ ) Description of the Microsoft Windows registry

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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:

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


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.

↑ Back to the top


References

For more information about shortcut keys, visit the following Microsoft Developer Network (MSDN) Web sites:

↑ Back to the top


Keywords: kbvs2005swept, kbvs2005applies, kbwindowsforms, kbregistry, kbforms, kbbutton, kbsettings, kbproperties, kbprb, KB843329

↑ Back to the top

Article Info
Article ID : 843329
Revision : 8
Created on : 4/3/2007
Published on : 4/3/2007
Exists online : False
Views : 386