Wednesday, January 7, 2009

Visual Studio 2008 Keyboard Shortcuts

Here are some extremely helpful keyboard shortcut keys for Visual Studio 2008. You probably know most, but some you won't know. For instance, did you know that Ctrl+. is the same as Sift+Alt+F10?

Note: Some of the shortcuts won't work in all environment configurations (web, C#, etc).

To use, hold down the control key and hit the key combination. Works on the whole document, a specific line, or a selection of code.

Go to Definition (F12) Navigate to the definition of the method or variable. Super useful.

Find all References (Shift + F12)

Update References/ Add Using Statement (Ctrl +. or Shift +Alt +F10) I'm referring to the underline that appears under a variable to perform an action like add a using statement, or refacter a method or class name. Not sure what it's called but I use it all the time. Ex: ClassName

List Members (Ctrl +J or Ctrl +K, L) Displays the autocomplete list for classes, methods, or properties.

List Parameter Info (Ctrl +Shift +Space or Ctrl +K +P) Lists the parameters for a method. Use this shortcut when your cursor is inside the parenthesis of a method.

Auto Format (Ctrl +K, D or Ctrl +E, D) Formats C#, VB, ASPX, Javascript, CSS, XML, XSL, and HTML code according to generally accepted formatting standards for the respective programming language. Makes code look nice and neat.

Quick Watch (Ctrl +Alt +Q) Highlight some code and hit these shortcut keys to display the Quick Watch dialog.

Comment / Uncomment (Ctrl +K, C / Ctrl +K, U) Comments or uncomments a block of code. Works with C#, VB, ASPX.

Code Bookmarks Use these to bookmark a line of code. You can cycle through the bookmarks across any file within a project. Bookmarks come in very handy, try it out.

Set/Unset Bookmark (Ctrl +K, K) Next Bookmark (Ctrl +K, N)

Surround With (Ctrl +S) Surrounds a block of code with a code snippet.

Build & Debug Shortcuts Set/Unset Breakpoint (F9) Build (F6 or Ctrl +Shift +B) Start Debugging (F5) Start Without Debugging (Ctrl +F5) Stop Debugging (Shift +F5) Continue (F5) Step Over (F10) Step Into (F11) Step Out (Shift +F11) Attach to Process (Ctrl + Alt + P)

That's it for now, feel free to add more in the comments below. I'll try to update this post periodically.

17 comments:

  1. Hi!
    I was just wondering whether (Ctrl +K, C / Ctrl +K, U) really works with CSS.

    ReplyDelete
  2. Ahh you caught me.. Comment/uncomment doesn't work for CSS files unfortunately. I wonder if MS will add support in 2010.

    ReplyDelete
  3. Hi Rob!!

    Here are few more

    Delete All Break Points (Ctrl +Shift +F9)
    Code Snippet Manager (Ctrl +K,B)
    Attach to Process (Ctrl + Alt + P)

    ReplyDelete
  4. Very Helpful, great job!

    ReplyDelete
  5. Surround With is (Ctrl + K,S)

    ReplyDelete
  6. I really enjoy reading your blog as the postings are so simple to read and follow. Outstanding. Please keep it up. Thanks.
    Diet Solution Program Review
    Diet Solution Program

    ReplyDelete
  7. I am software developer and these shortcuts will really minimize the time I use to code. these shorcuts would be really of use to me thanks

    ReplyDelete
  8. Aw, this was a really quality post. In theory I'd like to write like this too – taking time and real effort to make a good article… but what can I say… I procrastinate alot and never seem to get something done.

    ReplyDelete
  9. එල එල...නියමයි...බොහොම ස්තුතියි...

    ReplyDelete
  10. nice tips.....but not flexible for VC++ settings......

    ReplyDelete
  11. How about print and print options?

    Marc

    ReplyDelete
  12. hi ROB VOLK,

    Thanks very helpful post..


    Thanks and regards,
    kaviprashu

    ReplyDelete