Blog Archives
Visual Studio Tips: Move or select code between matching braces
This short and quick post is inspired by the Blog Post (Read) written by Pinal Dave (SQL Authority), describing shortcut to select code between two parenthesis in SQL Server. This can be very useful when we are working with complex queries. Fortunately, it is the same shortcut we use in Visual Studio (C++, C#).
To select code between two braces, we just need to press the key combinations CTRL+SHIFT+] after placing the cursor either on the opening or closing brace (in C++ and C#: Curly brace/ Square bracket/ Parentheses).
Another thing we can do is – travel/move between two parenthesis using key combinations CTRL+] .(applies to both SQL Server and Visual Studio)
Thanks for reading.
Visual Studio Tips: Copy/Paste multiple snippets in quicker way
In this quick post, I just want to share a very useful tip on Visual Studio which has been helping me numerous times since I learned it. While developing an application using visual studio, you may need to copy multiple words/lines/snippets which are not continuous on that form/page. With current facility of Windows(how far I know) we can only paste the content which is copied to the clipboard last time only. So, to copy and paste multiple snippets you have to copy a single snippet and then paste it on some other page/form and then again repeat the same process until you are done.
But with the feature I am talking about, you can copy up to 20 snippets to the clipboard and then can traverse through each snippet copied to the clipboard. This is called Clipboard Ring.
To copy the snippets just copy them with your own way like pressing CTRL + C or right clicking with your mouse etc.
Now, you can paste/traverse through copied snippets by pressing CTRL + Shift + V and CTRL+ Shift + Insert. or, Clicking Edit ->Cycle Clipboard Ring.
Thanks for reading !!!
Visual Studio Tips: Shortcut for Collapse/Expand code blocks
While developing windows/web – application using Visual Studio, several times we need to collapse/expand the code blocks/regions for clear reading and easy to manage the whole page of code. We do it by clicking the +/- sign on the left of the start of code block. But, when there is a good no. of code blocks/sections/regions then clicking each +/- sign is difficult. If the code blocks are large in size i.e, contain many lines of code then practically it is again a hard task to manage the code.
This difficulty can be avoided if we use following shortcuts -
1. CTRL + M + M —–> Collapse/Expand current section
2. CTRL + M + O —–> Collapse all regions
3. CTRL + M + L —–> Expand all regions
You may also like-
Bookmark in Visual Studio
While developing application using Visual Studio, sometimes we need to navigate between different lines of code. If the page contains several lines(lets say 1000 or more) then it becomes very time consuming work to navigate between different sections. For instance, when developing web application using ASP.Net if somebody wants to put Javascript validation for the controls already used in the page, then he/she has to move the cursor from the Javascript function to the line where the control is declared to get the Control Id. In this case we can use Bookmark provided by Visual Studio IDE.
The very simple syntax to use Bookmark can be -
(i) move your cursor to the line where you want to put the Bookmark and then press key combination “Ctrl+K” twice. Now you can see a rounded-cornered square mark on its extreme left, which is nothing but the bookmark.
(ii) to remove a bookmark follow the same procedure as above.
(iii)to navigate to the next Bookmark press key combinations “Ctrl+K”,”Ctrl+N”
(iv) to navigate to the previous Bookmark press key combinations “Ctrl+K”,”Ctrl+P”
One can use it smartly to improve his/her coding speed using Visual Studio IDE.
For detail information you can read it here abhijitjana.net by Abhijit Jana, who is one of my favorite blogger on .Net Technology.
For more tips on Visual Studio IDE, you can refer codeproject.com
More Tips on Visual Studio -
Shortcut for Collapse/Expand Code blocks in Visual Studio
Smart-Work is better than Hard-Work
