Share via


Defining Mnemonics (Access Keys)

 

The latest version of this topic can be found at Defining Mnemonics (Access Keys).

Normally, keyboard users move the input focus from one control to another in a dialog box with the TAB and ARROW keys. However, you can define an access key (a mnemonic or easy-to-remember name) that allows users to choose a control by pressing a single key.

To define an access key for a control with a visible caption (push buttons, check boxes, and radio buttons)

  1. Select the control on the dialog box.

  2. In the Properties Window, in the Caption property, type a new name for the control, typing an ampersand (&) in front of the letter you want as the access key for that control. For example, &Radio1.

  3. Press Enter.

    An underline appears in the displayed caption to indicate the access key, for example, Radio1.

To define an access key for a control without a visible caption

  1. Make a caption for the control by using a Static Text control in the Toolbox.

  2. In the static text caption, type an ampersand (&) in front of the letter you want as the access key.

  3. Make sure the static text control immediately precedes the control it labels in the tab order.

All the access keys within a dialog box should be unique.

To check for duplicate access keys

  1. On the Format menu, click Check Mnemonics.

For information on adding resources to managed projects, please see Resources in Applications in the .NET Framework Developer's Guide. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resources strings to properties, see Walkthrough: Localizing Windows Forms and Walkthrough: Using Resources for Localization with ASP.NET.

Requirements

Win32

See Also

Controls in Dialog Boxes
Controls