Monday, January 28, 2013

Tip 6.18: How to open a file in the solution without using either a tool window or a dialog box

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog

A blog reader's question inspired this tip. She receives a lot of e-mail asking her how to do something in Visual Studio. The majority of the questions she doesn't have the answers to, as they are out of her scope of testing or beyond her experience. So she's always excited and relieved to see a question that is within her scope, like this one in particular. When she saw the words, "keyboard shortcut" and "open a file," she knew she could give a meaningful reply.

The idea here is you just want to press some keyboard shortcut, type the file name that's in the solution, and go directly to that file. No Solution Explorer. No Open File dialog box. No UI. Here we go ...
  1. Press Ctrl+/. This brings you the Find combo box with the ">" already included for you.
  2. Type File.OpenFile . You'll notice support for autocompletion.
  3. Select a file, and press Enter to open the file.
Because the command File.OpenFile seems to her to be very long to type, you can use the following steps to create an alias that is shorter:
  1. Press Ctrl+/.
  2. Type alias fo File.OpenFile to create a command alias.
Now, for the rest of time or until you reset your command aliases, you can:
  1. Press Ctrl+/.
  2. Type fo <filename>.


And now your file is opened in the editor. Tool windows and dialog boxes are not required.

Happy Programming! =)
Posted by Nils-Holger at 12:47 PM with 689 comments.

Sunday, January 27, 2013

Tip 6.17: You can press Ctrl+/ to run Visual Studio commands in the Find combo box

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog

Sara Aside

She had to do a little research to remember what this feature is called. She remembers calling this feature the "command line" in her test cases. But, after some internal debates, she was told it is really just the Find combo box running commands. Regardless of what the feature is called, you can run Visual Studio commands without having to open the Command Window.

Press Ctrl+/ to reach the Find combo box; the ">" will be inserted for you. Of course, you could press Ctrl+D and then type > if you really wanted to. It's like Microsoft IntelliSense, but for Visual Studio commands instead.


Note that you may need to use a different keyboard shortcut, depending on which environment settings you are using. If Ctrl+/ does not work for you, go to Tools–Options–Environment–Keyboard to see what keyboard shortcut the Tools.GoToCommandLine command is bound to.

Happy Programming! =)
Posted by Nils-Holger at 12:34 PM with 430 comments.

Saturday, January 26, 2013

Tip 6.16: How to have fun with the Find combo box

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog

Sara Aside

She learned from her test cases that you can run commands via the Find combo box. But, when she found Shawn Farkas's blog (, it took what she knew about the Find combo box to a whole new level.

Following are some examples of commands you can run from the Find combo box, but the idea is that many Visual Studio commands take parameters that you can enter into the Find combo box. Hit the keyboard shortcut to a Visual Studio command, and the command will pull its parameters from the Find combo box. Press Ctrl+D to go to the Find combo box. Now here are a few ways you can have some fun:
  • Go to a line Type the line number, and press Ctrl+G. She likes showing this off as how you can do a "go to line" without popping up the Go To dialog box.
  • Go to a file Type the name of the file (either in your project or on the INCLUDE path), and press Ctrl+Shift+G.
  • Get help Type the keyword, and press F1.
You can also use command aliases, as shown here:
  • To get a call stack, type >kb.
  • To go to a Web page, type >nav


You can read Shawn's full blog post at

Happy Programming! =)
Posted by Nils-Holger at 1:42 PM with 444 comments.