Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I keep learning new keyboard shortcuts for Visual Studio and I find some of them increase my productivity a lot. I was wondering what keyboard shortcuts in VS you found useful and why.

I know I could find a list of shortcuts online somewhere, but I don't think that would be as beneficial to me as asking here since there are so many shortcuts and I think my eyes would just glaze over trying to read that list.

Here are some that are extremely useful to me:

F12 - Goes to the definition of any class or method. It has saved me so much time searching code files once I found that one out.

Ctrl+M, O|L - Expands/Collapses regions in C# or tags in XAML files. I love this feature in XAML files since I can't use Regions in them to make my code easier to read

Ctrl+R, E - Builds a property's Get/Set methods for me. That, combined with a few macros, makes building accessor methods a lot less painful

Ctrl+E, D - Fixes the whitespaces in code files

I also created my own keyboard shortcut to CloseAllOpenFiles since VS2010 moved the Close button on open files and I can no longer keep my mouse in one place and spam-click to close all my open files. Why would they they think its a good idea to put the close button on each tabs and make the tabs various widths....

share|improve this question

closed as off topic by Yannis Mar 17 '12 at 2:41

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Possible Duplicate of a SO question:… . – Bobby Nov 15 '10 at 16:06
that's a community wiki question on SO. We're here to earn rep ;-) – azheglov Nov 15 '10 at 16:27
Thanks, didn't know there was an existing post on SO. I thought it would get deleted there since it isn't programming-related – Rachel Nov 15 '10 at 16:36
@Rachel: But it is about software tools commonly used by programmers (quote from the FAQ), so it's On-Topic on SO (at least as I see it, and it's not closed, so that's a good sign ;) ). @azheglov: I'd say something very philosophical about that not the reputation counts...but heck, who does not want more reputation?! ;) – Bobby Nov 15 '10 at 18:02
ALT+F4 for after a long hard day (and quarter of a night) – J.T.S. Nov 15 '10 at 21:27
up vote 3 down vote accepted

share|improve this answer
You legend Pradeep. I'm sure I would have found this eventually, the VS2008 one for C# was gold. But hey thanks for being the one to find it for me! :D – Anonymous Type Nov 15 '10 at 21:49

CTRL+K,R - Find all references

ALT+SHIFT+ENTER - Full screen editing mode

CTRL+TAB - switch between documents (and tool windows) (this is not unique to VS, but still useful)

SHIFT+F10 - brings up context menu so you can use the keyboard for other things you might not know the shortcut to

Another useful one, maybe not a shortcut, is when navigating with the keyboard if you hold CTRL it will scroll the window while leaving your cursor in the same position. Also, nobody's yet mentioned good ol' F5 - debug.

share|improve this answer

Shift + F9: quickwatch popup. quickly inspect a variable. used while debugging.

share|improve this answer

CTRL + "-": It's like the back button in your browser. Use it after having jumped to a search result, or after you've used F12.

share|improve this answer
This is a good one. – Anonymous Type Nov 15 '10 at 21:45

I like ALT-CTRL-B to build the application. I tend to use that and then just refresh my website (and not the use the one below as that opens a new window).

Another favorite is - CTRL-F5 to start without debugging.

share|improve this answer

Alt+W W Home Shift+End Alt+C Esc - closes all code windows :-)

share|improve this answer
.... lol Thanks, but I think I like my custom Ctrl+Shift+W better – Rachel Nov 15 '10 at 16:37

CTRL + K + C|U: comment/uncomment selected lines of code

share|improve this answer
Didn't know there was a shortcut for that, thanks! I think I'm going to have to try and remap it though so I can hit that with one hand. The K is a little bit of a stretch for me – Rachel Nov 15 '10 at 16:39
Actually noticed Ctrl+E, C|U works the exact same way so don't need to remap anything – Rachel Nov 15 '10 at 16:46

I find these shortcuts very useful during debugging sessions:

CTRL + ALT + "e": to open the Exceptions window, where you can control how Visual Studio behaves when program exceptions are encountered (halt execution or ignore).

F9 - sets a breakpoint on the line of code your cursor is currently on.

share|improve this answer
Haven't had to use Exceptions window much but I use breakpoints all the time so +1 – Rachel Nov 15 '10 at 16:40

CTRL-K, D - format document

CTRL-. - resolve (add using)

share|improve this answer
CTRL-. is the greatest keyboard shortcut out there. :-) – Eric King Nov 15 '10 at 17:12
Ctrl + . is a great shortcut indeed. Must resist the urge to use it 25 times in the same code file! – azheglov Nov 15 '10 at 18:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.