Skip Navigation LinksHome > View Post
My new favourite keyboard shortcut in Visual Studio

On the subject of favourites I thought I'd share this little nugget with you that I got from a customer recently.

CTRL+K, CTRL+D (press one combination immediately followed by the other)

Not the easiest shortcut to remember but worth the investment - it reformats your code according to your preferences.

I used to achieve this by deleting and re-inserting closing braces '}' which causes the same event. Now I can do it without leaping about my source file. And the *best* thing about this keyboard shortcut is that it works in most file types! Yes! Including .xaml and .aspx.

Hooorah!

What's your favourite little-known tip for Visual Studio?

Josh Post By Josh Twist
11:11
26 May 2009

» Next Post: ViewModels and CheckListBoxes
« Previous Post: My favourite underused keyword in C# is...

Comments:

Posted by Tomas Restrepo @ 26 May 2009 14:51
Notice that you can also use Ctrl+K,Ctrl+F in many cases to format just the selected text.

Posted by FallenGameR @ 27 May 2009 01:00
Ctrl+M, Ctrl+O - collapse all regions
Ctrl+. - open smart tag (for automatic namespace adding for example)
Ctrl+Up/Down - scroll code

Posted by R2D2 @ 12 Jun 2009 17:11
My favourite shortcut is this...

http://www.microsoft.com/downloads/details.aspx?familyid=E5F902A8-5BB5-4CC6-907E-472809749973&displaylang=en

Enjoy!

Posted by jsimas @ 28 Jun 2009 12:43
A new one for me was Ctrl+M, Ctrl+L which expands all the folded code in a file.

Funny that both this post and the c# readonly post talk about stuff that is very natural and prevalent if you use Resharper.

Post a comment:

Name  

E-mail (never shared)

URL

Comments  

Captcha ImageRefresh Image
What's this?
Enter code above