Visual Studio .NET Tips & Tricks

Helpful information for Visual Studio .NET developers

Archive for the ‘Beginner’ Category

Tip: Most useful shortcuts in VS.NET

Posted by Ion Toma on April 17, 2006

Switching between Windows:

Ctrl+F6  – navigate between various panes that appear in the base code editing window.
Shift+Alt+Enter – full-screen mode at any time. In full-screen mode, only the active window is visible in full screen.
Alt+F6/Alt +Shift+F6 – move cursor away from the main editing section into docked windows like Properties, Help, Dynamic help, Server Explorer (if these winows are open).
F7 – Jump to Code Behind/Base Code editing window

Ctrl+Shift+V   – cycle through the clipboard ring.
Ctrl+- (Ctrl + Hyphen) – similar with Internet Explorer, very easy to navigate from page to page.
Ctrl+Shift+- – cycles in the opposite direction.
Block Selection: – press Alt and then select the area you want with your mouse.
Line No in Code – Tools>Options>Text Editor>All Languages>General>Line numbers.
Ctrl+] :matching brace/comment/region/quote
F4: Property Window
Ctrl+Alt+L – Solution Explorer
Ctrl+Alt+O – Output Window
Ctrl+Alt+K – Task List
Ctrl+Shift+Space – intellisense window.
Ctrl+R – Word Wrap

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

Code Format:
Ctrl+K, Ctrl+F – Auto-format selection
Ctrl+U – Convert to lower case
Ctrl+Shift+U – Convert to upper case
Ctrl+K, Ctrl+C – Comment selection
Ctrl+K, Ctrl+U – Uncomment selection

Code Outline:
Ctrl+M, Ctrl+M – Fold/Unfold the current code block
Ctrl+M, Ctrl+L – Unfold all
Ctrl+M, Ctrl+P – Stop outlining
Ctrl+M, Ctrl+O – Fold all

F5 – Start Application in debug Mode
Ctrl+F5 – Start Without debugging
F11 – Step into
F10 – Step over.
Shift + F11 – Step Out.
Shift + F5 – Stop debugging.
Ctrl+Shift+F5 – Restart Debugging.


Posted in Advanced, Beginner, Coding & Debugging, Intermediate, Miscellaneous, VS.NET 2003, VS.NET 2005 | Leave a Comment »

Tip: Select Block Text

Posted by Ion Toma on April 17, 2006

Normally, if we want to select several lines of text, this is done on line-by-line base.
With block selection, by holding the ALT key while dragging the cursor within the code window, we can select a rectangle, rather than selecting it line by line. We can call it vertical block selection. It can be very useful when we have to delete unnecessary text, like in the following example. Please take a look at the Flash Demonstration to see it in action.

Flash Demonstration

Posted in Beginner, Editor, VS.NET 2003, VS.NET 2005 | Leave a Comment »

Tip: Bookmarks

Posted by Ion Toma on April 17, 2006

Bookmarks can be used to mark places in the code, like the code that you might want to jump back and forward. Bookmarks can be related to task list shortcuts, kind of the same functinality.

The bookmarks can be setup very easy, by pressing CTRL+K, CTRL+K to leave bookmark. For navigation, you can press CTRL+K, CTRL+N to move to the next bookmark, or CTRL+K,CTRL+P for the previous bookmark.


Flash Demonstration

Posted in Beginner, Coding & Debugging, Editor, VS.NET 2003, VS.NET 2005 | Leave a Comment »

Tip: Word-wrap

Posted by Ion Toma on April 17, 2006

In case we got code that goes too long, we have to scroll out of the screen to see the whole line.
In Visual Studio .NET, there is an option to wrap the text around, we don’t have to scroll horizontal to see the whole line

To wrap the text around, hit the following combination:
CTRL+R, CTRL+R in .NET 2003
CTRL+E CTRL+W in .NET 2005
Disadvantage: it make the code look a little bit messy.  But working with line numbers, this may be avoided. Tools > Options and select a checkbox that allows to see the line numbers.

Note: this tip can be used also in the case when we have to move the mouse over an error description to be able to see the long line. Just hit CTRL+R CRTL+R in Output pane and the error description will wrap around.

Posted in Beginner, Coding & Debugging, Editor, VS.NET 2003, VS.NET 2005 | Leave a Comment »

Tip: Incremental Search

Posted by Ion Toma on April 17, 2006

To search, ussally you have to enter a CTRL+F and type the whole string and the search through the results.
Incremental search has a different behaviour: when you type CTRL+I, the code editor will move around as you type in and find any instance of the code you type in.

How to use it

Press Ctrl+I for incremental search mode. You can then enter text and drill down to the selection in the file that matches what you have typed.  The  incremental search can be initiated with Ctrl+I to see the last search pattern. Ctrl+Shift+I initiates a reverse incremental search, or switches a forward search to a reverse search.
Search - Image 5

 – There aren't any dialogs in incremental search interface, where the interactive search indicator is a cursor change after you press CTRL+I.
 – Less time is lost to search.  The search begins as soon as the first character is typed. You know immediately when you've got a good enough match and you can stop typing.
 – It's interactive, immediate search feedback alows you to adjust your search strategy in real time.


Incremental search doesn't look for text in hidden regions, but an regular search does it.

Posted in Beginner, Editor, Levels, VS.NET 2003, VS.NET 2005 | Leave a Comment »