Scott Cate Weblog 

scott.cate@myKB.com
http://scottcate.myKB.com



Scott Cate KB > Keyboard Shortcuts Start Over
Search the Knowledge Base
 
Start Search in the Following Category
Date Modified
Saturday, November 08, 2003
Block Selecting for Cut/Copy/Paste Operations

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


All rights reserved. All details are the personal opinion of Scott Cate.
All trademarks referenced are the property of their respective owners.
Scott Cate is a lead programmer for www.myKB.com and
owner of The Arizona .NET User Group and an all around nice guy ;)


Knowledge Base Software - myKB.com

 

Cameron Cate Pictures
Cameron Cate Pix

Site Navigation

Home
Knowledge Base
Wiki Discussions
Photo Album

Sites I Own & Run


Easy Search ASP.NET
mykb.com knowledge base software logo
myKB.com
Knowledgebase Software

KBAlertz.com
Arizona .NET user Group
Group Leader

Affiliations


ASP.NET MVP
2004
2005
2006
2007
2008
2009


Blog Sites I Read

Brady Gaster
Rob Howard
G. Andrew  Duthie
Robert McLaws
Alex Lowe

World of Scott.Net

Scott Guthrie
  -  Father of ASP.NET

Scott Watermasyk
  - .Text (Weblog)

Scott Sargent
Scott Mitchell
ScottG.net
Scott Bellware
Scott Forsyth
Scott Hanselman
Scott Cate

Favorite Books


ASP.NET Cookbook


First Looks @ ASP.NET 2.0