Click here to Skip to main content
11,495,049 members (36,488 online)
Click here to Skip to main content

Tips and Tricks for the Visual Studio .NET IDE

, 3 Feb 2004 363K 201
Rate this:
Please Sign up or sign in to vote.
A compendium of short cuts, tips and tricks, features, whatcha-may-callits for the Visual Studio .NET IDE.

Introduction

A compendium of short cuts, tips and tricks, features, whatcha-may-callits for the Visual Studio .NET IDE.

I love Vim. And the power it gives is almost corrupting. Actually it is corrupting. Which is why I try to see if any editor provides all the functionality provided by Vim. Visual Studio .NET has quite a lot of useful options. Many of them are out there in the open in the menus but I did not see them for long until I went hunting for them. Some others are very obvious, but when I show them to some people, they are amazed that I can do that; so I have included some of those too. So here is a list of useful hints that I gathered. If you have any more, please do send them and I'll add them here with due recognition to the contributor. Smile | :) By the way, I do not take credit for these hints but I will take credit for putting them together from various sources on the net.

1. Record and play temporary macro

Ctrl+Shift+R to record a new temporary macro. Press Ctrl+Shift+R to stop recording. Ctrl+Shift+P to play the recorded macro.

This works similar to *recording* in Vim. If you think you are going to be repeating a set of keyboard keys, then record them once and play them each time after.

2. Multiple copy/pastes

Ctrl+Shift+V cycles through the clipboard ring. You can copy/cut multiple times from one area of code, then go to another area and paste them one after another.

3. Drag and drop code snippets

The Toolbox (Ctrl+Alt+X) window has multiple tabs. You can drag and drop code onto this window and copy it elsewhere. Some tabs do not allow dropping code into them; those that allow will have the appropriate icon. The General tab works for me.

4. Previous cursor positions

Ctrl+- i.e. Ctrl + Hyphen. This cycles you through the code positions you visited.

Ctrl+Shift+- to navigate in the opposite direction.

5. Incremental search

To incrementally search for text as you type, first press Ctrl+i. Then type the word you want to search. Hit backspace to clear a character and enter to finish. Pressing F3 after this will work as usual, i.e. search for the next occurrence of previous search.

Ctrl+i - Ctrl+i works like F3.

6. Matching brace/comment/region/quote

Ctrl+] takes you to the matching brace. It also takes you to the matching comment, region or quote depending on what is at the cursor now.

7. Vertical block selection

Press Alt and then select the area you want with your mouse.

8. Closing/Showing support windows

There are a bunch of necessary/useful windows in the Visual Studio IDE like Properties (F4), Solution Explorer (Ctrl+Alt+L), Output Window (Ctrl+Alt+O), Task List (Ctrl+Alt+K) etc. However, they take up a lot of space. An easy way around this is to use the auto hide feature.

Open the window you want. Right click on its title and choose Auto Hide. The window will dock in whenever your mouse is not hovering over it.

9. Tab groups - group code editor windows

If you have many source code windows open, you can group them logically using tab groups. Right click the tab of the code window and choose New Horizontal Tab Group. This will move the window into a split window, allowing you to see both files. You can add more files to this new tab group and also move files back to the previous group by choosing Move To Previous Tab Group.

10. Track things you have to do with Task List

The Task List window (Ctrl+Alt+K) allows you to keep track of the things you have to do. Right click on the Task List window and choose Show Tasks|All to see a list of tasks. Ctrl+Shift+F12 to cycle through your list of tasks.

By default, comments marked with a TODO will appear in the task list.

11. Edit Task List Comment Tokens

You can add your own set of comment tokens (like the TODO comment token). Goto Tools|Options|Environment|Task List|Comment Tokens and make your changes. You can change the priority appearance of each comment token too.

12. Add Task List Shortcut

Add a shortcut to the task list with Ctrl+K, Ctrl+H. This will add the current line to the task list.

13. Auto-complete

Press Ctrl+Space or Alt+RightArrow to auto-complete the word. Intellisense suggestions may pop up a window if there is more than one possibility.

14. Intellisense suggestions window

Press Ctrl+Shift+Space to bring up the intellisense suggestions window. When giving parameters for functions, I often need to escape the suggestions window to check another part of code. To bring it back, I used to delete a comma and then type it again; but this is easier.

15. Word wrap

Ctrl+R Ctrl+R

or

Tools|Options|Text Editor|All Languages|General|Word Wrap

If you want to set this option for only one language, then choose the appropriate language instead of All Languages.

16. Line numbering

Tools|Options|Text Editor|All Languages|General|Line numbers.

If you want to set this option for only one language, then choose the appropriate language instead of All Languages.

17. Customizing Visual Studio's Code Generation Templates

Customizing Visual Studio's Code Generation Templates.

18. Default Shortcut keys

MSDN.

19. Favorites window

Your IDE also functions as a browser. To see your list of favorites, press Ctrl+Alt+F or choose View|Other Windows|Favorites.

20. Bookmarks

Bookmarks are available through Edit|Bookmarks. Bookmarks allow you to mark places in your code that you would want to come back to.

  • Create/Remove Bookmark - Ctrl+K, Ctrl+K
  • Move to next bookmark - Ctrl+K, Ctrl+N
  • Move to previous bookmark - Ctrl+K, Ctrl+P
  • Clear all bookmarks - Ctrl+K, Ctrl+L

21. Code Formatting

  • Auto-format selection - Ctrl+K, Ctrl+F
  • Convert to lower case - Ctrl+U
  • Convert to upper case - Ctrl+Shift+U
  • Comment selection - Ctrl+K, Ctrl+C
  • Uncomment selection - Ctrl+K, Ctrl+U

22. Outlining

I like this feature that allows me to hide code that is irrelevant to what I'm currently working on.

  • Fold/Unfold the current code block - Ctrl+M, Ctrl+M
  • Unfold all - Ctrl+M, Ctrl+L
  • Stop outlining - Ctrl+M, Ctrl+P
  • Fold all - Ctrl+M, Ctrl+O

23. Build and Debug

  • Build - Ctrl+Shift+B
  • Run - Ctrl+F5
  • Debug - F5
  • Cycle through build errors - F8

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

SathishVJ

France France
~/sathishvj

Comments and Discussions

 
GeneralThanks soooo much!!!!!!!!!!! Pin
Fifi Young27-Jun-14 9:39
memberFifi Young27-Jun-14 9:39 
Suggestion[My vote of 2] You should make it clear which theme this applies to. Pin
Kevin Whitefoot26-May-14 22:27
memberKevin Whitefoot26-May-14 22:27 
GeneralMy vote of 5 Pin
Mathieu Hicauber26-Jul-13 0:58
memberMathieu Hicauber26-Jul-13 0:58 
QuestionNice one and good hard work Pin
Marla Sukesh22-Jun-13 10:10
professionalMarla Sukesh22-Jun-13 10:10 
QuestionCtrl+i - Ctrl+i works like F3 Pin
Member 1004880313-May-13 6:10
memberMember 1004880313-May-13 6:10 
QuestionTip number 16 - Line number Pin
CIAP21-Dec-12 2:50
memberCIAP21-Dec-12 2:50 
GeneralMy vote of 5 Pin
Mateen Khan13-Jun-12 1:30
memberMateen Khan13-Jun-12 1:30 
GeneralMy vote of 3 Pin
srinivaskumar pasumarthi23-Sep-11 3:43
membersrinivaskumar pasumarthi23-Sep-11 3:43 
GeneralWonderful List Pin
Simon Clifton Cardenas4-Jan-11 21:54
memberSimon Clifton Cardenas4-Jan-11 21:54 
Questionautocomplete Pin
Francesco Pasquesi9-Sep-10 23:33
memberFrancesco Pasquesi9-Sep-10 23:33 
QuestionHow to open and close a Tool Window in VS 2005 (and beyond) Pin
Suresh R Iyer14-Jun-09 2:01
memberSuresh R Iyer14-Jun-09 2:01 
GeneralMore tips. Pin
prabir26-May-09 8:10
memberprabir26-May-09 8:10 
AnswerGetting Vi/Vim power from within Visual Studio Pin
zcrar7020-Dec-07 3:25
memberzcrar7020-Dec-07 3:25 
GeneralCodeWinPos Pin
michaelmakuch19-Jul-07 17:36
membermichaelmakuch19-Jul-07 17:36 
GeneralRe: CodeWinPos Pin
kovarex21-Oct-07 3:15
memberkovarex21-Oct-07 3:15 
Questionintellisense with my code ? Pin
ChrisRibe13-Jun-07 6:40
memberChrisRibe13-Jun-07 6:40 
AnswerRe: intellisense with my code ? Pin
Vikash Dubey24-Jul-07 20:22
memberVikash Dubey24-Jul-07 20:22 
GeneralRe: intellisense with my code ? Pin
ChrisRibe30-Jul-07 22:20
memberChrisRibe30-Jul-07 22:20 
Questiontab position is not remebered Pin
mikiunu9-May-07 4:46
membermikiunu9-May-07 4:46 
AnswerRe: tab position is not remebered Pin
Andrew Phillips16-May-07 21:59
memberAndrew Phillips16-May-07 21:59 
GeneralBlock select keyboard shortcut? [modified] Pin
Ken Hadden1-May-07 6:35
memberKen Hadden1-May-07 6:35 
GeneralRename Pin
notbono17-Apr-07 15:55
membernotbono17-Apr-07 15:55 
GeneralRe: Rename Pin
K.L.K15-Apr-08 15:15
memberK.L.K15-Apr-08 15:15 
GeneralBookmarks Pin
dankoGreiner14-Jul-06 1:10
memberdankoGreiner14-Jul-06 1:10 
GeneralRe: Bookmarks Pin
Peter Wucherer18-Apr-07 23:42
memberPeter Wucherer18-Apr-07 23:42 
GeneralRe: Bookmarks Pin
Andrew Phillips16-May-07 21:48
memberAndrew Phillips16-May-07 21:48 
GeneralDefinition Pin
StrattonN20-Apr-06 5:52
memberStrattonN20-Apr-06 5:52 
GeneralRe: Definition Pin
NpnDan20-Jun-07 5:17
memberNpnDan20-Jun-07 5:17 
GeneralLast Position Pin
StrattonN20-Apr-06 4:57
memberStrattonN20-Apr-06 4:57 
QuestionProperties Window: Ctrl+Shift+First letter to move to property name Pin
LuluSailor26-Jan-06 12:59
memberLuluSailor26-Jan-06 12:59 
GeneralQuick Copy and Smart Paste Pin
viggity17-Jan-06 10:51
memberviggity17-Jan-06 10:51 
GeneralEmbeeded VIM in Visual Studio .NET Pin
oriol_rai10-Oct-05 1:54
memberoriol_rai10-Oct-05 1:54 
GeneralCustom toolbar Pin
Alligator8-May-05 20:03
memberAlligator8-May-05 20:03 
GeneralRe: Custom toolbar Pin
SathishVJ8-May-05 20:39
memberSathishVJ8-May-05 20:39 
GeneralRe: Custom toolbar Pin
C#newcomer14-Nov-05 10:15
memberC#newcomer14-Nov-05 10:15 
GeneralGuidelines for the text editor Pin
SathishVJ13-Dec-04 5:05
memberSathishVJ13-Dec-04 5:05 
GeneralRe: Guidelines for the text editor Pin
registrationisformexicans2-Jan-07 13:14
memberregistrationisformexicans2-Jan-07 13:14 
GeneralVisual Studio .NET Tips and Tricks Book Pin
Anonymous27-Oct-04 14:16
sussAnonymous27-Oct-04 14:16 
Generalkeyboard tab navigation Pin
hyling11-Oct-04 9:08
memberhyling11-Oct-04 9:08 
AnswerRe: keyboard tab navigation Pin
Christopher Scholten31-Jul-06 10:40
memberChristopher Scholten31-Jul-06 10:40 
AnswerEnsuring CTRL+F6 iterates through MDI windows in the VS.NET IDE Pin
Christopher Scholten15-Sep-06 7:29
memberChristopher Scholten15-Sep-06 7:29 
Generalpiff Pin
Anonymous30-Sep-04 18:01
sussAnonymous30-Sep-04 18:01 
Generalcopy and paste trick Pin
feline_dracoform1-Apr-04 0:42
memberfeline_dracoform1-Apr-04 0:42 
GeneralRe: copy and paste trick Pin
feline_dracoform2-Apr-04 4:08
memberfeline_dracoform2-Apr-04 4:08 
GeneralTab Groups Pin
Anonymous20-Feb-04 5:07
sussAnonymous20-Feb-04 5:07 
GeneralDialog / Form Preview Pin
Santosh M. P.18-Feb-04 16:04
memberSantosh M. P.18-Feb-04 16:04 
GeneralGood job! Pin
Mitchell17-Feb-04 10:13
memberMitchell17-Feb-04 10:13 
GeneralRe: Good job! Pin
Cab13811-Mar-04 4:34
sussCab13811-Mar-04 4:34 
GeneralAdditional tips and bouquets and brickbats Pin
SathishVJ15-Feb-04 23:49
memberSathishVJ15-Feb-04 23:49 
GeneralDoes VS.NET IDE provide this function Pin
eXRange12-Feb-04 19:26
membereXRange12-Feb-04 19:26 

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 | Terms of Use | Mobile
Web03 | 2.8.150520.1 | Last Updated 4 Feb 2004
Article Copyright 2004 by SathishVJ
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid