I used this today and realized it's a nice little time saving feature. Block Selecting is the ability to highlight text in multiple rows by column, not the entire row.
Here's where I used it. I found in my code that I created a New Sytem.Text.Stringbuilder and then had about 15 .Append("") Commands. So the code looked something like this.
|
Dim sbMessage as New System.Text.Stringbuilder sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") sbMessage.Append("Whatever") |
And I was able to use the select block feature to quickly change this to a With Statement.
Place your cursor at the top left, or the bottom right of the block of text that you are wanting to select, and then hold the ALT key down first, then the SHIFT Key, then your cursor to move to the opposite corner of your selection block.
So here are the steps I took to move these statements into a With Statement
- Directly underneath the Dim statement I added "With sbMessage" and press enter.
- This automatically inserts the "End With" statement.
- Then I moved all the sbMessage.Append Rows into the With statement.
- Finally the Selection Block. I put my cursor on the last line after the "e" in sbMessage. Hold down ALT+SHIFT then arrow up to the first line and then left to the beginning of the line. with the block selection I can delete all of this in one delete key, instead of having to delete each line one by one.
It's really comes in handy to know Block Selection. Remember that you have to hold the ALT key first, Then SHIFT or it will not work.
And now my code sample looks like this.
|
Dim sbMessage as New System.Text.Stringbuilder With sbMessage .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") .Append("Whatever") End With |