Tuesday, June 5, 2012

Very Useful Uncommon Shortcuts in Visual Studio


There are many useful shortcuts in Visual Studio(Most of them works well in SQL-Management Studio too) but its difficult for us to remember them all. However, it will be help-full if we know few of them which we may need frequently. I observed several developers using the shortcuts like Ctl + K + DCtl + K + CCtl + Shift + UCtl + Uetc...but as per my observation some of the other important shortcuts are unknown for several developers. Hence, I have planned to list out few of the useful shortcuts which I know and used frequently.
Collapse: Ctl + M, O
Used to Collapse the code to its definition. Alternatively, you can press them together(Ctl + M + O). Once you collapsed the code using this shortcut, then you can use Ctl + M, L to expand the same.

Toggle Collapse All and Expand All: Ctl + M, L
To toggle all outlines. That is Collapse all and Expand all. Alternatively, you can press them together(Ctl + M + L).

Column wise Select: Shift + Alt + Arrow keys
Using this shortcut, you can select the code column wise. Alternatively, you can use Shift + Alt + (a mouse click on the desired location).



Remove white space: Ctl + K + \
Using this shortcut, you can remove the white space by mass. The below print screen is taken from SQL Management Studio.


Line Number: Ctl + G
Used to jump to the particular line. Its very useful when you have thousands of lines and want to jump to a particular line. I have used it many times when an exception occurs(i.e to go to the line where the actual exception occurred).
If the line numbers are not enabled in your system, you can enable it by following these steps(However, its not mandatory to enable LN to use Ctl + G):
  •  Go to Tools -> Options
  • Expand Text Editor -> All Languages(or your preferred language)
  • Check the check box Line Numbers


Navigate Tabs: Ctl + Tab or Ctl + Shift + Tab
Used to navigate between opened files on Visual Studio(as well as  SQL-Management Studio).

No comments:

Post a Comment