[tweetmeme source=”aabdulmoniem” only_single=false]
Update:
Box selection is one of the old features of the VS but it was only supporting you in VS 2008 with deleting or either copying this text.
ScottGu said:
Box selection is a feature that has been in Visual Studio for awhile (although not many people knew about it). It allows you to select a rectangular region of text within the code editor by holding down the Alt key while selecting the text region with the mouse. With VS 2008 you could then copy or delete the selected text.
VS 2010 now enables several more capabilities with box selection including:
- Text Insertion: Typing with box selection now allows you to insert new text into every selected line.
- Paste/Replace: You can now paste the contents of one box selection into another and have the content flow correctly.
- Zero-Length Boxes: You can now make a vertical selection zero characters wide to create a multi-line insert point for new or copied text.
All you have to do is to click on ALT key + left mouse button and then drag. What will you see?
As you can see there is light blue box is drawn as long as you drag. This box represents as a boundary to some text in the code file. You can then do whatever you want with this selection either to copy it for example or even delete it.
Let’s see more appropriate example. What if I have some public variables and I want to make them all private.
The old way to make this, is to go line by line and change public to private but if I have 10 lines, or may be 100, or even 1000?! This is really a consuming task.
Here is the box selection comes to the rescue. See the next screen shots:
[…] This post was mentioned on Twitter by ahmed.abdulmoniem. ahmed.abdulmoniem said: RT @aabdulmoniem VS 2010 First Look :: Box Selection « AbdulMoniem's Thoughts http://wp.me/p1IhL-6h […]
Just letting you know, box selection has been supported by VS (via the same Alt-key mechanism) since at least VC6.
Yes you are right, but:
VS 2010 now enables several more capabilities with box selection including:
* Text Insertion: Typing with box selection now allows you to insert new text into every selected line
* Paste/Replace: You can now paste the contents of one box selection into another and have the content flow correctly
* Zero-Length Boxes: You can now make a vertical selection zero characters wide to create a multi-line insert point for new or copied text
and all these new features wasn’t supported in the old versions.
Nice Tip 🙂
Thanks 4 sharing
very nice feature
“The old way to make this, is to go line by line and change public to private but if I have 10 lines, or may be 100, or even 1000?! This is really a consuming task.”
Search and replace?
What if I want to search for different strings with different patterns? What if I want to replace the public keyword for only 10 lines not the whole files? What if I want to copy some lines to use them to replace another ones?!
Box selection has been in VS for ages, it’s not a new VS2010 feature.
See my comment @Chris Forbes