This is a list of 10 great shortcuts me and my co workers use frequently, we thought you all should know too. Here they are:

  1. CTRL + ".": This is actually a shortcut for a shortcut. it is the same as CTRL + SHIFT + F10 which opens the smart tag window and allows you to add Using statementsAdd Using Statement

    Or implement interfaces Implement Interface

    and much more.

  2. ALT + CTRL + "e":  This one will open the Exceptions window, which allows you to tell Visual Studio to halt at specific exceptions, halt on all exceptions or selecet some exceptions to ignore.

    Exception Popup Windows 

  3. CTRL + "k" + "f" and CRTL + "k" + "d": these two will format the code in the window to be nicely indented. using "d" will format all the document while using "f" will format only selected text. The formatting is for all types of documents, HTML, Xaml, XML, C#… This one is my favorite.

  4. SHIFT + Del: This one will cut the entire row from the document and past it to the clipboard. No need to select the row, just put the marker there and click SHIFT + Del and it is gone.

  5. CTRL + "k" + "c" and CTRL + "k" + "u": These two are for commenting selected text (the "c" options) and uncommenting selected text (the "u" option).

  6. ALT + ENTER: this little shortcut will open up the Properties windowProperties Window

  7. CTRL + "k" + "s": This one opens up the code snippets dialogue within the code

    Open Snippets Dialogue

    If you want to create code snippets you should read my post about snippy the code snippets editor.

  8. F12: I think you all know this but still F12 is the shortcut for the "Go to definition" command which will take you to the definition of the object your marker is currently on.

  9. F9: Another one i think you all know, clicking on F9 will add a breakpoint to the code line your marker is currently at. Clicking F9 again will remove this breakpoint from that line.

  10. CTRL + ALT + "q": This one will open the Quick watch window while you debugOpen Quick Watch Window

That’s all I have for now. If you know of more cool shortcuts we missed, please comment.

Amit

Tags :

59 Responses to “10 Visual Studio Shortcuts You Must Know”


  1. Vijay Santhanam

    Said on April 17, 2008 :

    CTRL -
    and
    CTRL SHIFT -

    moves the editing cursor to the last/next position

    this is great if you decide to edit something somewhere else and you wanna go back to that last method you were editing. CTRL – will save you so much time!

  2. Bryan Migliorisi

    Said on April 17, 2008 :

    Nice list.

    Alt + Enter is also a general Windows shortcut for accessing properties of files, drives, shortcuts, etc. It is a nice keystroke to keep in mind.

  3. Pablo Marambio

    Said on April 17, 2008 :

    Shift + Alt + Enter (FullScreen mode) is a must know! It helps you to get rid of all the properties, toolbar and other [obstrusive] windows that don’t let you see the code. Hit it a second time and the windows are back.

  4. knave

    Said on April 17, 2008 :

    CTRL+M+M : Expanding / Collapsing code blocks, e.g. regions/methods.

  5. Greg Beech

    Said on April 17, 2008 :

    CTRL + ALT + P (attach to process) is very useful when you’re debugging web sites, windows services, etc.

    CTRL + R + R (rename) is great for refactoring, particularly if you have ReSharper installed

  6. Diego

    Said on April 17, 2008 :

    SHIFT + F9 for quick watch :) even better than CTRL + ALT + Q

  7. Matt Brunell

    Said on April 17, 2008 :

    Ctrl+Shift+B — Build solution
    Ctrl+J — Intellisense, list members
    Ctrl+Shift+Space — Intellisense, list parameter info

    The list members shortcut is handy. Before I started using this a lot, I would sometimes type ‘this.’ to get a list of members. The parameter info is helpful for seeing information about parameters you already typed in.

  8. Terry Aney

    Said on April 17, 2008 :

    Lot of items can be accessed from the ‘Context Menu Key’ (assuming your keyboards have that key…the one that looks like a little menu)…

    CTX+Q – Quick Watch
    CTX+D – Definition
    CTX – same as CTRL+. above

    I generally can get almost anything done with CTX+key or CTX then a quick combo of down and right arrows.

    Anyway, just my preference, by no means the end all.

  9. Dmitry Moskalyk

    Said on April 18, 2008 :

    You can also open properties window just by pressing F4. I like it more than Alt+Enter.

    A year ago I was using Ctrl+K,Ctrl+X to insert a snippet, but I have understood that the easiest way to do it is to type snippet name and press “Tab” afterwards.

  10. Steven

    Said on April 18, 2008 :

    I suggested Ctrl+A then DEL to my … less than able colleagues … didn’t go down well!

    Anyway, here’s my favourite – even if it’s not really a shortcut …

    Ctrl + space

    while coding lets VS finish for you or open intellisense if what you’re type’d is to ambiguos

    “string rediculouslyLongName;
    ret” then Ctrl + Space gives you

    “string rediculouslyLongName;
    rediculouslyLongName”

  11. David Hu

    Said on April 20, 2008 :

    I use F8 and shift+F8 to cycle through search results. It’s a gem for me.

    I think, if anything, the VS team should add an option in Visual Studio to annotate all Menu items with their corresponding shortcuts.

  12. Sam

    Said on April 22, 2008 :

    I am bookmarking this right now. I will have more to say in a few days. Thanks!

  13. Dylan Vester

    Said on April 22, 2008 :

    You should probably note that some of these are ReSharper only shortcuts. Maybe I missed that somewhere. Just a thought.

  14. wekempf

    Said on May 6, 2008 :

    Dylan Vester,

    Which shortcuts do you think are ReSharper only shortcuts? I don’t own ReSharper. I’ve been using the majority of these shortcuts for years. The few that were new to me worked.

  15. Amit

    Said on May 6, 2008 :

    Non of them are resharper shortcuts. I know that because I dont use resharper as it takes more resources than Windows Vista :). I am more of a Visual Assist kind of guy.

    Amit

  16. ichbinvinh

    Said on September 24, 2008 :

    F4 = ALT + ENTER —> show properties

    Ctrl + r + e : to generate get and set methods for member

    Anyone know shortcut view all of Methods in class (same as Ctrl + o in eclipse) ?

  17. Jeroen

    Said on December 31, 2008 :

    ctrl-c without selecting anything copies a row (ehh, ctrl-v to paste it)

    ctrl-a to select all, ctrl-k ctrl-f to format the code

    f-12 to go to definition of item under cursor

  18. Steve

    Said on February 6, 2009 :

    Ctrl + r + e : to generate get and set methods for member

    Anyone know how to do an entire block? For example highlight all 3 rows below and generate the methods in one shot instead of select and generating each one?

    public string test1;
    public string test2;
    public string test3;

  19. dell

    Said on February 16, 2009 :

    ctrl + ]
    moves you to the beginning or end of a snippet, [], {}, etc.

  20. Charles Rex

    Said on March 26, 2009 :

    Hello,

    >Ctrl + r + e : to generate get and set methods for member
    >Anyone know how to do an entire block?
    >For example highlight all 3 rows below and generate the methods >in one shot instead of select and generating each one?
    >public string test1;
    >public string test2;
    >public string test3;

    Try this tool:

    http://www.adersoftware.com/index.cfm?page=vsPropertyGenerator2

    I find it useful, it would have been perfect if the tool would be released as open source.

  21. Charles Rex

    Said on March 26, 2009 :

    Hello,

    Ctrl+Tab is a very handy shortcut as well.

    Ctrl+Tab flips forward and backwards, between the last two accessed files.

  22. Manish Jaiswal

    Said on May 28, 2009 :

    I think the third point which is:

    ” 3. CTRL + “k” + “f” and CRTL + “k” + “d”: these two will format the code in the window to be nicely indented. using “d” will format all the document while using “f” will format only selected text. The formatting is for all types of documents, HTML, Xaml, XML, C#……”

    is for older version(s). For VS 2008, it is CTRL + “E” + “F” and CRTL + “E” + “D”.

  23. Sangam Uprety

    Said on June 9, 2009 :

    Ctrl+Shift+H is equivalent to Ctrl+H and does very smart job for find and replace. Further, first do Ctrl+F for find and then just press F3 for next match. Easy!

    A number of such short keys have made life easier. These ones are also worth looking at: http://dotnetspidor.blogspot.com/2009/06/22-visual-studio-short-keys-and-6-short.html

    Happy Programming!

  24. gaurav

    Said on September 4, 2009 :

    Ctrl + Shift + F7 ….highlights the usages of any variable,methods …Find it very useful

  25. Max Quagliotto

    Said on October 24, 2009 :

    I personally like the following combo to clean up all my code and then go looking for a certain code-block:

    CTRL+K,D (to format the page)
    CTRL+M,O (to collapse to definitions)

    or if you want to expand all definitions: CTRL+M,P

  26. Anonymous

    Said on November 23, 2009 :

    Visual Studio: Developer tools for developers who don’t realize Linux is better for software development.

    Call me when Microsoft actually makes Visual C++ standards compliant.

  27. Charles Rex

    Said on December 15, 2009 :

    This morning I’ve discovered these two (I’ve tested only C#)

    Alt+UpArrow
    Alt+DownArrow

    Go to the beginning of the function
    Go to the end of the function

  28. Naga

    Said on December 29, 2009 :

    Thanks all for putting all the shortcuts at one place. It was really helpful.

  29. Dilip

    Said on January 18, 2010 :

    Cycle ClipBoard Ring
    Shortcut:- Ctrl + Shift + Insert

    Its very useful command to paste the previous copied text.

    e.g
    Dark
    Wadia

    If I copy Dark and later again copied wadia

    If You use Ctrl + Shift + Insert(pressed once to get Wadia and
    pressed twice to get Dark).

  30. Dilip

    Said on January 18, 2010 :

    Edit -> Cycle ClipBoard Ring
    Shortcut:- Ctrl + Shift + Insert

    Its very useful command to paste the previous copied text.

    e.g
    Dark
    Wadia

    If I copy Dark and later again copied wadia

    If You use Ctrl + Shift + Insert(pressed once to get Wadia and
    pressed twice to get Dark).

  31. Danilo

    Said on January 29, 2010 :

    F7 – Turn visibility between code, markup and both :)

    Nice article!!

    Danilo

  32. Josh

    Said on February 16, 2010 :

    Ctrl + L to cut the entire line (copied to clipboard)
    Ctrl + Shift + L to delete an entire line (not copied to clipboard)
    Ctrl + Space to finish a variable/member name
    Ctrl + } to go to the end/start bracket while on end/start bracket (of a method/condition etc)

  33. Tango

    Said on February 22, 2010 :

    I don’t work for resharper but I use it at work and the new version takes a TON less resources and is a lot faster than previous versions.

  34. Jonty

    Said on March 29, 2010 :

    Re number 4. If you just cut (ctrl + x) it will do the same thing.

  35. S.Girach

    Said on June 9, 2010 :

    . += “2 times tab key”

    Write objectname then event name then write plus sign(+) then equals sign(=) then press tab key two times.

    This will generate the event code for the required object event.

  36. Malice

    Said on July 7, 2010 :

    Welcome
    Ctr + Shift + u – uppercase the word
    Ctr + u – lowercase
    Ctr + w – select whole word under cursor

    Ctr + space open IntelliSense list

    ctr+-, ctr+shift+insert, ctr+shiflt+b – good to know
    Thanks

  37. Prasanna

    Said on July 29, 2010 :

    Is there a short cut (hot key) to collapse all items in solution explorer.

  38. Chirag

    Said on September 3, 2010 :

    Anyone know short cut of creating dafinatio of written subroutine or function. like i type the name of subroutine which is still not defined.

    Thanx

  39. Thaddeus Hultberg

    Said on October 31, 2010 :

    I’d have to recognize with you one this subject. Which is not something I typically do! I love reading a post that will make people think. Also, thanks for allowing me to comment!

  40. Abhishek

    Said on November 23, 2011 :

    @Prasanna: CTRL+M, CTRL+O

  41. bunker

    Said on January 12, 2012 :

    [Ctrl] + [,] + [,]

18 Trackback(s)

  1. Apr 18, 2008: Very Useful Visual Studio Shortcut Keys « Rams On It - .NET
  2. Apr 18, 2008: Interesting Finds: 2008.04.18 - gOODiDEA.NET
  3. Apr 18, 2008: links for 2008-04-18 « dstelow notes…
  4. Apr 19, 2008: WPF/Silverlight/XAML Web Links - 2004/04/18 - Rob Relyea - Xamlified
  5. Apr 20, 2008: Dew Drop - April 19, 2008 | Alvin Ashcraft's Morning Dew
  6. Apr 21, 2008: Weekly Links: ASP.NET MVC, Silverlight 2, WPF, WCF… | Code-Inside Blog International
  7. Apr 21, 2008: Wöchentlichen Rundablage: ASP.NET MVC, Silverlight 2, WPF, WCF… | Code-Inside Blog
  8. May 2, 2008: BLOG STATS FOR APRIL 2008 | Dev102.com
  9. May 21, 2008: Visual Studio 2008 Shortcuts
  10. May 28, 2008: Weekly Link Post 38 « Rhonda Tipton’s WebLog
  11. Jun 12, 2008: CREATING VS KEYBORAD SHORTCUTS CHEAT SHEET | Dev102.com
  12. Jun 27, 2008: The 20 most kicked “top-10 stories” for Developers « .Net Braindrops
  13. Jun 30, 2008: The Tomes Of Experience » 10 Must Know Visual Studio Shortcuts
  14. Jan 12, 2010: Shortcut pada Microsoft Visual Studio « Doni eS Pe
  15. Feb 4, 2010: Great Shortcuts http://www.dev102.com/2… « Ask Visual Studio
  16. Apr 12, 2010: Useful Visual Studio Shortcuts - MVi
  17. May 26, 2010: 10 Visual Studio Shortcuts You Must Know « Power through Simplicity
  18. Nov 19, 2010: Visual Studio formetting shortcut key conbinations | Bazmech.net

Post a Comment