Did you know… You can insert a snippet via “tab tab” – #234

This was tip #7 from my TechEd 2008 VS IDE Tips and Tricks.  A few months ago, I had dinner with Alan Stevens, Chris Woodruff, and a few others who were creating one of the Microsoft certification exams.  One of the developers said, “hey sara, you need to blog about Snippet Tab Tab.”  I was blown away.  i had tested this feature inside and out, and never had heard of “tab tab.”  It turns out that it is just the sequence of keystrokes you use to insert a snippet, but i never even thought to refer to it as the “tab tab” feature.

I’m not a C# developer.  I spent the majority of my time writing code in VB during my software testing days.  Whenever I need to use C#, i heavily rely upon code snippets, since i don’t recall the syntax off the top of my head.

When in the appropriate place in the editor, you can type in the keyboard shortcut of a snippet, like “for”


In this state, you can simply press tab twice to insert the snippet, or stated more market-ing-ly (if that’s a word), “tab tab.” 

Why twice?  Press it once to auto-complete statement completion.  If you just type ‘f’ for “for”, and the “for” is highlighted, you can just press tab once to complete the word for.  Press it twice to generate the snippet, since the cursor will be at the end of the word “for” in the editor.


And the moral of the story is “<snippet> tab tab.”

Technorati Tags: VS2005Tip,VS2008Tip

Comments (12)

  1. As it may not be immediately clear from the original post, this works in VB too!

  2. Hi Sara, thank you for the now every day use tip "Tab Tab". I didn’t realize that some commands like for, if, while etc. are existing as a snippet.


  3. A little snippet that I use from time to time when I need information on how long something takes. Type

  4. Bit--Flipper says:

    thats awsome… i thought the tab-tab only works when using "prop" like "prop"+tab-tab and u get "public int MyProperty { get; set; }"… dint know it works with all keywords… great, great GREAT….

  5. Yuthavong says:

    awesome!! and my thoughts and practice the same as what bit-flipper mentioned on properties tab tab. glad it works on other keywords too.. WOOHOO!!!

  6. Hitesh says:


    i did not know that asp.net provides such help too.


  7. ... says:

    I noticed in VB… that you can just press Space once and it does the exact same thing… Or I might be completely wrong. =)

  8. nicksql2000 says:

    Excellent Tip Sara!

    I tried it in VB2005Express, type "for" then press tab once {market as snippet-tab} – provides same WONDERFUL "codesmithing" for you.  Then the highlighted fields the IDE gives you as "to change here" are now in the tab-order.  That’s some good stuff there; as I was in the same boat, VB6 then C#, then back to VB6 and now VB.NET [don’t ask] :-), so sometimes/often my syntax isn’t the best, but I know what I want – this helps get me where I need to be.

  9. Remy says:

    Do you know where to find a list of available commands that support the tab+tab combo? I mean, we all know prop, for, foreach, event subscription via event += tab+tab (which is a life saver), try, switch (which works great when using fixed collections like structs since it creates the switch case instruction for every item in the collection and… I guess those are all I remember

  10. phil brown says:

    do you have an tips on using the datarepeater when i use a datarepeater all of my formats disappear for dates, times, number and it goes back to the default i think. also the combobox does not work in a datarepeater.

  11. Tip #0 Know your Keybindings! General Development Settings Searching Tips Tip #1 How to behold the power

Skip to main content