Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Coding Aids
 How to: Assign a Shortcut Name to a...
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual Studio
How to: Assign a Shortcut Name to a Snippet

Shortcut names provide a way for you to insert IntelliSense Code Snippets into your code by typing a shortcut name and then pressing Tab. The shortcut name for an IntelliSense Code Snippet is changed by modifying the XML .snippet file.

To change the shortcut name for a snippet

  1. Locate the .snippet file for the snippet that you want to edit. The snippets that appear in the picker are stored as files in subfolders of specific file locations. The file locations can be examined and changed using the Code Snippets Manager.

  2. On the File menu, click Open and then click File.

  3. Click the file you want to open, and then click Open.

  4. In the editor, locate the Header element of the code snippet.

  5. Add a Shortcut element as a child of the Header element. Make the text value of the Shortcut element the shortcut name. For example, if the following code were part of a Visual Basic code snippet XML file, you would type "MyShortcut" and press Tab to insert the code snippet.

    w5dewx15.alert_note(en-us,VS.90).gifNote:

    You must press Tab twice to insert Visual C# and Visual J# code snippets.

    <Shortcut>MyShortcut</Shortcut>

    w5dewx15.alert_note(en-us,VS.90).gifNote:

    The text value of a Shortcut element can only contain alphanumeric characters, hyphens ( - ), and underscores ( _ ).

  6. Save the file.

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker