Click here to Skip to main content
13,191,400 members (72,738 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

29.9K views
29 bookmarked
Posted 15 Nov 2013

10 ways to get more productive in Visual Studio

, 20 Nov 2013
Rate this:
Please Sign up or sign in to vote.
10 ways to get more productive in Visual Studio.

Visual Studio is full of shortcuts and handy tools helping you, as a programmer, to be more efficient in your work. Today I'm sharing a few of my favourite ones. All examples given here are tested in Visual Studio 2012.

  1. Open search result in a list
  2. Press CTRL + F to open the search pane. Enter your search string and then next to the find button you can open alternative search ways and select Find all.

    Find all

    Besides taking you to the first occurrence of the text searched for, Visual Studio also opens a Find Results window (normally at the bottom) with all the occurrences of the search phrase.

    Find results

    In this window you can click through all locations and at the bottom you'll also get some statistics of what has been found.

    Another way of doing this search is to press CTRL + SHIFT + F and click on the Find All button in the dialog that opens.

  3. Find active document in Solution Explorer
  4. Using menu options like “Go to definition” is great. But sometimes you’re taken to a document and you have no idea where the document belongs, especially if you have plenty of projects. By clicking on the Sync with Active Document button (see picture below), Solution Explorer will navigate to the location where the current document exists and mark it.

    Synchronize file views in Visual Studio

  5. Debugger.Break
  6. It might sound a bit strange to have a hard coded break in your code but it can be useful for testing purposes. Breakpoints are very handy but they can be easily turned off, while this line of code has to be removed to prevent debugger from stopping. An example is shown here:

    try
    {
    
    }
    catch (Exception)
    {
      // Please report to ... if your debugger breaks here
      Debugger.Break();
    }

    The Debugger class can be found in the System.Diagnostics namespace.

  7. Cut the line
  8. If you mark a text and press CTRL + X that text will be cut. But if you don’t mark any text and press the same CTRL + X the whole line (including carriage return) will be cut. You can also press CTRL + L to cut the whole line without the carriage return.

  9. Move line up or down
  10. Hold down ALT while pressing up or down and you’ll move the current line up or down.

  11. Zoom
  12. Hold down CTRL while you’re using the wheel on your mouse and you can easily zoom in and out as needed.

  13. Auto format the document
  14. Are you facing a document with a lot of wrong indentations? Press CTRL + K, CTRL + D to format the whole document. If you only want to format a smaller selection then select the code and press CTRL + K, CTRL + F. If you open the menu Tools | Options | Text Editor you can adjust how Visual Studio is going to do this formatting.

  15. Select vertically and update all lines at once
  16. Hold down ALT while you’re selecting a code snippet. You’ll then be able to do a vertical selection instead of line by line selection. Funky, right?

    VerticalEditSelect

    But it doesn’t stop there. You can also do a simultaneous update of all the lines you’ve marked. In the example below we’re able to change all variables at once from private to public.

    VerticalEditNew

  17. Scroll with arrow keys without moving marker
    Hold down CTRL while pressing up or down and you’ll scroll the window while keeping the marker at the same position. The effect is equal to using the scroll wheel on the mouse or the scroll bar at the side of the window, but you need the mouse to do both of them while this is a key-only option.
  18. View all open windows in a list
    Press CTRL + TAB or CTRL + SHIFT + TAB to open this overview window. You can then move around using the TAB key or the arrows. Very convenient!
    ctrlshifttab

More tips and tricks for Visual Studio can be found at these places:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Johan Ohlin
CEO BJ Focus Ltd
United Kingdom United Kingdom
Johan is the CEO of BJ Focus Ltd, a UK company specialised in the development of business structure platforms helping companies to structure flows of organisable data.

He writes articles on the BJ Lab's blog, especially when his customers keep asking the same thing. You might find a few of these articles here on CodeProject.

Currently his focus is on building MVC web apps on the Azure platform, but PHP and MySQL get their share of attention as well.

Johan has double masters, in business and in software development, and an MCTS in .Net Framework 4, web applications.

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionHow to open all? Pin
Louis van Alphen8-Mar-15 1:59
memberLouis van Alphen8-Mar-15 1:59 
QuestionGood List Pin
DKnight76420-Nov-13 3:13
memberDKnight76420-Nov-13 3:13 
AnswerRe: Good List Pin
Johan Ohlin20-Nov-13 4:05
memberJohan Ohlin20-Nov-13 4:05 
SuggestionNice list Pin
pbpb16-Nov-13 12:07
memberpbpb16-Nov-13 12:07 
GeneralRe: Nice list Pin
Johan Ohlin20-Nov-13 4:05
memberJohan Ohlin20-Nov-13 4:05 
GeneralNice article Pin
SpArtA15-Nov-13 12:10
memberSpArtA15-Nov-13 12:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171017.1 | Last Updated 20 Nov 2013
Article Copyright 2013 by Johan Ohlin
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid