RSS

Category Archives: Visual Studio Tips and Tricks

Visual Studio IDE Tips & tricks: ShortCuts for playing with blocks regions

How many times we get fed up of all the cluttered code? Best thing to do is put regions and collapse the regions to free up some space…

  • 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
Advertisements
 

Tags: , , , , , , ,

Visual Studio IDE Tips & tricks: ShortCuts for formating code , commenting code , wordwrap code

ShotCut Keys

Convert selected code to lower case – Ctrl+U
Convert selected code to upper case – Ctrl+Shift+U
Comment selected code – Ctrl+K, Ctrl+C
Uncomment selected code – Ctrl+K, Ctrl+U

WordWrap

Have a line of code which goes beyond the screen width? but you need to keep it that way and the only alternative is to scroll all the way to the right?
Well theres good news VS IDE provides a (toggle) shortcut which will put the line contents beyond the screen width on the next line and back onto the same line.

ShortCut Key : – Ctrl + r + r (toggles)

 
 

Tags: , , ,

Visual Studio IDE Tips & tricks: Bookmarks & Incremental Search

Bookmarks

Bookmarks are available through Edit – > Bookmarks.
using bookmarks we can mark places in our code which we would like to revisit later on.
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

Incremental Search Pressing

Ctrl+i will incrementally search for text as you type.

HOWTO : 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.

 
 

Tags: , , , ,

Visual Studio IDE Tips & tricks: ShortCuts for Coding

Convert selected code to lower case – Ctrl+U
Convert selected code to upper case – Ctrl+Shift+U
Comment selected code – Ctrl+K, Ctrl+C
Uncomment selected code – Ctrl+K, Ctrl+U

WordWrap

Have a line of code which goes beyond the screen width? but you need to keep it that way and the only alternative is to scroll all the way to the right?
Well theres good news VS IDE provides a toggle shortcut which will put the line contents beyond the screen width on the next line and back onto the same line

ShortCut Key : – Ctrl + r + r (toggles)

 

Tags: , ,

Visual Studio IDE Tips & tricks: Shortcut Letting .Net remind you of the TODO task in your code

Letting .Net remind you of the TODO task in your code

.Net IDE provides a mechanism of keeping track of all the TODO tasks in your code.This is done through the Task window
Using the “TODO“ Keyword we can tell .NET IDE to remind us about this TODO task in the task window

HOWTO : – simply add a comment to your code that starts with the TODO keyword. It will automatically be added to your existing Task list.

E.g : – // TODO: Need to optimise the AuthoriseUser Method.

To view the Task list (ShortCut Key : Ctrl+Alt+K ):-

select View > Other Windows > Task List from the menu .
The Task list often filters its contents, so it displays only certain information. To view everything, right-click on your list and select All Tasks > All.

 

Tags: , , , ,

Visual Studio IDE Tips & tricks: shortcuts to code snippets Adding frequently used code to toolbarVisual Studio IDE Tips & tricks:

Storing Often-Used Code in the Toolbox

If there is some often-used code and templates that you repeatedly have to use across various code behinds what would you usually do ?
Copy that code snippet somewhere , say … in notepad or something and everytime you need it you will simply copy it back into the code behind. Well thats the most obvious thing to do, but did you know that VS IDE allows us to store code snippets into the toolbar for later use??

HowTO : – Simply drag and drop your code straight onto one of the toolbox tabs, such as the General tab or create your own tab . When you need to use it again, simply drag and drop back into your code window.These code snippets will persist there across projects.Hence making our job easier.

 

Tags: , , , ,