Every couple of weeks I'll watch another developer use a Visual Studio feature or shortcut I didn't know about and force me to gape in awe as my mind tries to calculate how many hours of frustration and tedium I could have avoided if I had used that feature or shortcut. So in the interest and hopes of saving other developers countless hours of frustration and tedium, five Visual Studio tricks I use daily (and wish I had known about years ago):

1. Shortcut: Ctrl + Period

![](http://cvanopstal.files.wordpress.com/2010/08/addusingreference3.gif) align="right" /> Adds a using reference to the library of the object you're trying to use. I often find myself using StringBuilder without having remembered to add using System.Text. No worries, just hover over StringBuilder and hit Ctrl + Period and it'll ask you which library to import. You never have to break your flow to scroll to the top of the page and scroll back. Beautiful little productivity booster.

2. Shortcut to close all windows

An hour into development I'll often look up, and realize I have about twenty windows open and that the tab I wanted is now hidden and a myriad of files I no longer need have filled the tabbar. To add insult to injury Visual Studio makes closing all of the windows an exercise in mouse dexterity -- since different filetypes often have different toolbars, you will find yourself chasing the close icon for each tab back and forth across the screen as toolbars appear and vanish.

There is unfortunately no built-in keyboard shortcut that will close all windows, but this can quickly be remedied:

  1. Go to Tools > Options (make sure to check “Show all settings”)
  2. Go to Environment > Keyboard
  3. Find and select “Window.CloseAllDocuments”
  4. And then tie it to the shortcut of your choice (I’m using Ctrl + Alt + F4)

3. Format this selection, format this document

Visual Studio will allow you to format an entire document (Ctrl + K followed by Ctrl + D) or the current selection (Ctrl + K followed by Ctrl + D) to whatever defaults you’ve configured Visual Studio to use. Extremely handy when you’ve just copy/pasted some code or are trying to clean up that snake’s nest of HTML you’ve ended up with. Be wary of formatting you ASPX pages however as the formatting seems to break down entirely inside of controls (in DataGrids for example).

4. Find In Files vs Find

Searching through an entire project in Visual Studio is agonizingly slow. Time-for-lunch slow. To rub it in further they’ve even gone through the trouble to add a “Cancel” button which — as far as I can tell — does absolutely nothing.

Switching to the Find In Files search (Ctrl + Shift + F) is a much quicker alternative and is now my default when searching across large projects.

5. Show hidden files

This one isn’t really a trick — heck it had been staring me in the face for years — but the button in your Solution Explorer that allows you to view all files is often so useful I couldn’t pass it up. Visual Studio helpfully declutters the solution explorer by hiding files you probably don’t want or need, of course what Visual Studio thinks you don’t want or need to see is usually wrong, so I often find this button extremely handy during development.