Working with Shortcut Keys (Lisa Feigenbaum)

Lisa Feigenbaum

Since we have so many Orcas posts going up on this blog, I’ve decided to continue with a few that you can use TODAY in Visual Studio 2005.  This one is about working with shortcut keys…

For those of you using the Visual Basic Development Settings, your keyboard scheme is set to Visual Basic 6 by default.  You can verify this by checking the setting in Tools->Options->Environment->Keyboard.

The complete list of keyboard shortcuts for the currently bound commands in the VB6 scheme is located here(Note: This is also a good source for command descriptions.)

Once you have this initial set of keyboard shortcuts, there are a number of things you might want to do…  You might want to change the shortcut for an existing binding; you might want to add a shortcut for a command that does not yet have one; or you might want to export your keybinding set to import it on another machine.

The information pasted below is actually an excerpt from one of our MSDN docs: How To: Work with Shortcut Key Combinations.  It addresses the commonly asked questions we often get about these tasks.  So, read on!

Determine the Shortcut Key Assigned to a Command

You can manually search for a command to determine whether or not it has a shortcut key combination.

To determine the shortcut key combination for a command

  1. On the Tools menu, click Options.

  2. Expand the Environment folder and select Keyboard

    Note: If you do not see the Keyboard page, check Show all settings located in the lower left of the Options dialog box.

  3. In the Show commands containing box, enter the name of the command without spaces.
  4. For example, solutionexplorer.

  5. In the list, select the correct command.

    For example, View.SolutionExplorer.

  6. If a shortcut key combination exists for the command, the combination appears in the Shortcut(s) for selected command drop-down list.

Create Custom Shortcut Keys

You can create new shortcut key combinations for any command or change the shortcut key combination for commands with existing combinations.

To create a new shortcut key combination

  1. On the Tools menu, click Options.

  2. Expand the Environment folder, and select Keyboard.

    Note: If you do not see the Keyboard page, check Show all settings located in the lower left corner of the Options dialog box.

  3. In the Show commands containing box, enter the name of the command without spaces.

    For example, solutionexplorer.

  4. In the list, select the command you want to assign to a shortcut key combination.

  5. On the Use new shortcut in drop-down list, select the feature area in which you want to use the shortcut. For example, you can choose Global if you want the shortcut to work in all contexts. Unless the same shortcut is mapped (as Global) in another editor, you can use it. Otherwise, the editor overrides the shortcut.

  6. Place the cursor in the Press shortcut key(s) box, and then use the keyboard to enter the key combination you intend to use for the command.

    Note: Shortcuts can contain the SHIFT, ALT, and/or CTRL keys in combination with letters.

    Note: The following keys cannot be assigned: ESC, PRINT SCRN/SYS RQ, SCROLL LOCK, PAUSE/BREAK, TAB, CAPS LOCK, INSERT, HOME, END, PAGE UP, PAGE DOWN, Windows logo keys, Application key, any of the ARROW keys, or ENTER; NUM LOCK, DEL, or CLEAR on the numeric keypad; or CTRL+ALT+DELETE

    Be sure to check the Shortcut currently used by box to see if the key combination is already assigned to another command in the mapping scheme. Press BACKSPACE to delete the key combination, if the combination is already in use, before trying another combination.

  7. Click Assign.

    Note: Changes made using the Assign button are not cancelled, if you click the Cancel button.

Exporting and Importing Shortcut Keys

You can share the shortcut key combinations in the current keyboard mapping scheme by exporting the information to a file so others can import the data.

To export shortcut keys only

  1. On the Tools menu, choose Import and Export Settings Wizard.

  2. Select Export select environment settings, and then click Next.

  3. Under What settings do you want to export?, clear all categories selected by default.

  4. Expand Options, and then expand Environment.

  5. Select Keyboard and then click Next.

  6. For What do you want to name your settings file?, enter a name, and then click Finish.

To import only shortcut keys

  1. On the Tools menu, click Import and Export Settings Wizard.

  2. Select Import select environment settings, and then click Next.

  3. Click No, just import new settings, overwriting my current settings, and then click Next.

  4. Under My Settings, select the settings file that contains the shortcut keys you want to import, or click Browse to locate the correct settings file.

  5. Click Next.

  6. Under Which settings do you want to import?, clear all categories.

  7. Expand Options, and then expand Environment.

  8. Select Keyboard, and then click Finish.

0 comments

Leave a comment

Feedback usabilla icon