.NET Tips and Tricks

Blog archive

4 Must-Know Visual Studio Keyboard Shortcuts

Here are four keyboard short cuts for things you probably do often in Visual Studio.

  1. You want to add a blank line after the line you're on. You don't have to go to the end of the line and hit the <Enter> key. Just leave your cursor where it is and use Ctrl+Shift+Enter (Ctrl+Enter adds a line above).

  2. You want to uncomment a block of commented code. You don't have to select the whole commented block. Just put your cursor somewhere in the commented block and type the uncomment chord: Ctrl+K, U.

  3. You've got an error on line and see the little red bar that marks the SmartTag that provides the options for fixing the problem. You don't have to fiddle with the mouse to display the dropdown list of options. You can just type Ctrl+. (You don't even have to move your cursor back to the line in error).

  4. You type an object name, type a period, type the first letter of the member you want and get an IntelliSense list with lots and lots of entries. You don't have to type the whole name of the member you want. IntelliSense in Visual Studio 2010 recognizes camel-casing, so if you hold down the Shift key and type the capitalized letters in the member name you want, IntelliSense will give narrow the list down to that one.

Posted by Peter Vogel on 05/31/2012 at 1:16 PM


comments powered by Disqus

Reader Comments:

Sat, Feb 2, 2013 Voventus Buy Lipitor Generic

Yea, re-sharper is the worst. Someday they will actually fix it.

Fri, Jan 25, 2013 Klavdia Buy Lipitor Generic

Yea, re-sharper is the worst. Someday they will actually fix it.

Fri, Jan 25, 2013 Micky

I saw http://blogunlimited.com/MohammedRashid/archive/2012/05/03/s DOT hortcut-keys-for-visual-studio-2010.aspx very helpful. You may like it.

Fri, Nov 30, 2012 Nathon Dalton Beaverton, OR

Oh, and as far as #2 goes, both of you are correct. Using default keyboard mapping in VS2010, commenting and uncommenting can be done by using both CTRL-E and CTRL-K as the group. The CTRL-E is for editing and the CTRL-K group is for Intellisense. Commenting/uncommenting falls under both. I'd recommend learning the CTRL-K version though since it also applies to SQL Server Management Studio.

Fri, Nov 30, 2012 Nathon Dalton Beaverton, OR

Yea, I've been doing most of these. In the F12 "IE Developer Tools" in IE, I also love the "Select element by Click" tool. If you want to see all the CSS, HTML, etc. code associated with a specific item on the page, press CTRL+B and then hover your mouse over the page. When you select an item, it'll auto-navigate to that item and show everything associated with it like CSS. It's very useful. Other helpful items are CTRL+G in VS go to directly to a line number reported in an exception. Press F12 when cursor is on an object to go to the definition of that object. CTRL+- navigates you back to the previous cursor point (useful when F12-ing). Have a lot more but don't want to use the whole page.

Wed, Jul 25, 2012 Lenny NY

Consider a fast usb stick (think usb 3.0) and a readyboost cache with all optimizations in device manager for the drive. That will really improve VS performance, especially if you have a few instances open. I work with 3-4 VS instances and I can't imagine doing it without my stick! Think parallel transfer and high random access performance!

Mon, Jul 23, 2012 Carsten Thomsen Denmark

"Shouldn't #2 be Ctrl + E, U ? "E" for Edit." Actually, in most configurations you can use either. The same goes for CTRL+E, C, or CTRL+K, C.

Tue, Jul 17, 2012

Shouldn't #2 be Ctrl + E, U ? "E" for Edit.

Fri, Jun 15, 2012 Bob

What version are you guys using? Resharper kicks some serious but. Can you find another tool that can point out problems in your code or automatically optimize convert your code into streamlined, efficient Linq queries? If you're not using Resharper, your really wasting your time. As for the slowness, that used to be a problem, but it's been alleviated in the most recent versions. You must also note that it doesn't play nicely with some VS Addins. The can installer detect and uninstall incompatible Addins you have installed. Give it a try, you won't be dissappointed.

Wed, Jun 13, 2012 GEO

1. Or, use VsVim and type the letter "o" (as in "o"pen) instead of wasting 3 virtually meaningless keystrokes.

Mon, Jun 11, 2012

Yea, re-sharper is the worst. Someday they will actually fix it.

Sat, Jun 9, 2012 Peter Vogel Canada

I'd never tried using F12 in an HTML page--who knew? (well, you, apparently). That's neat. I like CodeRush very much also and I don't really have a good reason for preferring ReSharper (especially because I started life as a VB programmer and ReSharper was, for the longest time, mostly about C#). They're both excellent products.

Tue, Jun 5, 2012 DustinHorne Omaha, NE

Peter: F12 it is! Unless this was part of one of my extensions... I just discovered today that F12 will also go to definition of a CSS class if you click it while the cursor is in a classname in your HTML.

Sat, Jun 2, 2012 Peter Vogel Canada

KINECT_DEV: One of my favourites, also! But usually, when I want to get to a class (or something else) it's because I'm looking at a reference to it in code. For that, nothing beats clicking on the class name and pressing F12.

Fri, Jun 1, 2012 kinect_dev

My favorite is Ctrl + , (comma) to bring up a dialog where you can type the name of a class or member and zoom right to it. For large projects this saves tons of time hunting for files.

Fri, Jun 1, 2012 Peter Vogel Canada

You do need a seriously powered computer to run ReSharper but I'm still a fan. Though: There's nothing so embarrassing as being at a client's site, working one one of their computers in front of a client, doing something and then pausing to wait for ReSharper to work some magic. Eventually, the client looks at you funny and you realize that they don't have ReSharper installed and type it in yourself...

Fri, Jun 1, 2012

Only for Visual Studio to crash constantly and slow it down to a crawl. Especially if you are using XAML. Not to mention the fact the code it wants you to write is seriously ugly (I use StyleCop). No thanks ReSharper, good idea, poor execution.

Thu, May 31, 2012 Ravi

Or use Resharper, that will increase your productivity way higher

Add Your Comments Now:

Your Name:(optional)
Your Email:(optional)
Your Location:(optional)
Comment:
Please type the letters/numbers you see above

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.