Click here to Skip to main content
Click here to Skip to main content
Go to top

Visual Studio Tips & Tricks for Developers:- This includes some shortcuts features in Visual Studio 2008 which will increase your productivity

, 13 Dec 2008
Rate this:
Please Sign up or sign in to vote.
Visual Studio Tips & Tricks to increase development productivity

Introduction

Most of us use Visual Studio IDE in our daily programming and coding.So this article will tell you few tricks and tips by which you can enhance your productivity and efficiency.  

Tips & Tricks

  1. Working in Full Screen Mode in Visual Studio
    1. Alt+Shift+Enter is the shortcut to enter to fullscreen mode in Visual Studio
    2. Its sometimes really helpful and more appealing for developers to work in full screen mode
  2. Editing
    1. For Copying a line in the IDE just go to the start of the line and press Ctrl+C,there is no need to select anything
    2. For Pasting a line just go to the start of the line and just press Ctrl+V
    3. For Deleting  a line just go to the start of the line and press Ctrl+X,  this is not actually delete but its similar to cut if you do Ctrl+X on current line and go to some other place in your code and do Ctrl+V then it will paste the same line there. CropperCapture_1_.jpg 
  1. Expanding and Collapsing the code units
    1. This nice little shortcuts has saved me a lot of time.Whenever i am working on a large piece of code i always get confused and make some changes in other Method or property because they were looking similar.
    2. But now with this shortcut i collapse one method as soon as it is finished.
    3. The shortcut is Ctrl+M+M.
    4. Just go to the beginning or end of the method or property or any code block and hit the shortcut it will expand or collapse the code block comparing to its present state.
    5. If you want to collapse all your code units or blocks to their definitions then the shortcut to achieve this is Ctrk+M+O or Ctrl+M Ctrl+O.This is also a very handy shortcut which helps a lot in development.
  2. Automatic Text Indentation and Formatting
    1. This shortcut helps me to write beautiful and decorative code which is easy to understand by any person.
    2. Shortcut is just press Ctrl+K+D.
    3. This works not only in C# and VB code behind but it works well in aspx pages.
    4. If you want to just format the selected piece  of code then just press Ctrl+K+F
  3. Automatically adding Namespaces
    1. Use the Ctrl+. (Remember this is Ctrl+[period] if you get confused) shortcut key to automatically get intellisense for probable namespaces.
    2. Just press enter to include the required namespace.
    3. There are much cooler tricks when using a refactor like Resharper.I will discuss those tricks later this month in one of my posts.
  4. Commenting And Uncommenting The Code
    1. This trick saved me a lot of time.
    2. Just select the code to be commented and press Ctrl+K+C,this will comment your code block.
    3. For uncommenting the code just press Ctrl+K+U,this will uncomment the code block.
  5. Automatically generating properties
    1. Generating dummy getter and setters or properties is also a pain in big projects.
    2. Although i would recommend you some refactors like Resharper which can do it for you or some code generators like Code Smith and also give a try to inbuilt on in Visual Studio 2008 called T4 or Text Template Transformation Toolkit.
    3. But if you don't have such a mass volume project and just don't want to write your getter and setters then just type this prop + TAB+TAB
    4. Remember you don't have to type all of this but you only type prop and then press TAB two times for VS2008 to automatically generate the property for you now you can change the name and any other thing by navigating and just pressing TABS.
  6. Increasing and decreasing the indentation
    1. Select the code block for which you want to increase the indentation and after selecting just press TAB,this will increase the indentation.
    2. To decrease the indentation just select the required code block and then press SHIFT + TAB,this will decrease the indentation of the selected code block.
  7. Selecting a single word then line and then other lines within that block and then.......
    1. This is also a cool trick if you are in middle of something and want to do something on either the word you are on or the entire code block, or entire method, or entire class then just go on pressing Ctrl+W,it will start selecting for you starting from the current word.
    2. After selecting the desired code block you can perform any operation on that code block.
  8. Build & Debug Shortcuts and tricks
    1. To build  a solution just press Ctrl+Shift+B
    2. To start debugging just press F5
    3. To stop debugging just press Shift+F5
    4. If you are already debugging or your WebDev.WebServer.Exe is running or any other webserver is running you can directly attach to that process escaping the hussle to build again this is a great time saver.Remember always build or rebuild if you have done some major changes but if simply you want to debug and have done no changes in any other class library projects then you can use this trick
    5. Simply Press Alt+D+P then the Attach to process window will open.
    6. Simply choose your web server process to attach and you will see without building your entire solution your solution has been attached to the debugger

 

CropperCapture_7_.jpg

 

  1. Find Options
    1. You are already familiar with Ctrl+F option to find something either in current documents or all open documents or entire project  or entire solution,but another find option is Ctrl+Shift+F, this trick is helpful when you want all your results to be listed in a find window rather then to navigate one by one in every file where the searched string exists.
  2. Switching Between Design And Source Views
    1. F7 is the key used to switch between design and source (ie c# or vb files) views in IDE
    2. If you want to just toggle the markup's design and source view or want to view both then press Ctrl+PageDown
  3. Some other common used shortcut keys which can be helpful
    1. Ctrl+Alt+L for opening Solution Explorer
    2. F4 for opening properties window
    3. Ctrl+Alt+X for showing the toolbox
    4. Ctrl+\+T for displaying the tasklist
    5. Ctrl+\+E for displaying the error list
  4. How to navigate between various opened tabs inside Visual Studio
    1. Ctrl+TAB key will let you navigate between various open tabs in Visual Studio IDE
  5. Going to Declaration and then again returning to the actual usage
    1. Just press F12 to go to declaration CropperCapture_5_.jpg 
And press Ctrl+- to return back to the piece of code where you were earlier.

CropperCapture_6_.jpg 

Selecting Source Control Plugin

  1. If you are working in a team you probably will be using a source control there are many options to choose SVN,Visual SVN,TeamFoundationServer,Source Vault and Source Fortress and many others.
  2. But when selecting a client you have to mention it in Source Cotrol Plugin Selection as shown below
  3. CropperCapture_2_.jpg
     
CropperCapture_4_.jpg

I want solution for every project which i create

  1. If you want a solution for every project which you create then you have to enable this as shown below
  2. CropperCapture_3_.jpg 

Happy Programming!!!! 


License

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

Share

About the Author

Aashish Kumar Gupta
Software Developer www.rampgroup.com(;Ramp Technology Group)
India India
I am a Software Developer currently working for Ramp Technology Group India in Hyderabad.
My interest include working on latest Microsoft Technologies.
I have worked on various Technologies including Asp.net 2.0,Asp.net 3.5,C#,VB.Net,Linq,ORM's,SitefinityCMS,CSS,JQuery
SqlServer,Aspnet Ajax.
Currently i am digging through Asp.net MVC and Jquery
 
You can visit me at my blog
http://smallworkarounds.blogspot.com
 
Contact No:- +91-9347334788
Email Address:- eraashishgupta@gmail.com

Comments and Discussions

 
QuestionGreat job PinmemberIvanhoe.Jurasek25-Nov-13 22:55 
QuestionTips & tricks PinmemberMember 1024184629-Aug-13 20:56 
GeneralMy vote of 1 Pinmemberivix4u12-May-10 1:18 
GeneralRe: My vote of 1 Pinmembernbgangsta10-May-11 22:47 
GeneralOne more tip.. PinmemberColinM12315-Jan-09 16:42 
Generalnice article PinmemberJas 00712-Jan-09 0:15 
GeneralThank You PinmemberEnigmatic30-Dec-08 1:25 
GeneralVery Nice (& question) [modified] PinmemberGary Noter24-Dec-08 5:45 
Generalnice :) Pinmemberfire_birdie16-Dec-08 19:49 
GeneralRe: nice :) PinmemberAashish Kumar Gupta16-Dec-08 21:52 
Generalgood job PinmemberRahul.C#Net16-Dec-08 15:36 
GeneralGreat tips Pinmemberzmariow15-Dec-08 23:49 
GeneralReally helpful tips!!! PinmemberDwain Browne15-Dec-08 18:03 
GeneralGreat article Pinmembervvvlad15-Dec-08 9:27 
GeneralDelete a line Pinmemberjpsstavares14-Dec-08 22:37 
GeneralRe: Delete a line PinmemberHipster Dufus15-Dec-08 0:47 
GeneralAutomatic formating PinmemberRobert Taylor14-Dec-08 22:35 
GeneralGreat article PinmemberBrij14-Dec-08 22:13 
GeneralRe: Great article Pinmemberash143gupta15-Dec-08 2:27 
GeneralGood Tips PinmemberAbhijit Jana14-Dec-08 21:55 
GeneralRe: Good Tips Pinmemberash143gupta15-Dec-08 2:28 
GeneralQuality of illustrations PinmemberDmitri Nesteruk14-Dec-08 9:03 
GeneralRe: Quality of illustrations Pinmemberash143gupta15-Dec-08 2:29 
Generalvery useful tips! Pinmemberyxv-200514-Dec-08 6:37 

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

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

| Advertise | Privacy | Mobile
Web03 | 2.8.140921.1 | Last Updated 14 Dec 2008
Article Copyright 2008 by Aashish Kumar Gupta
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid