This blog has, IMO, some great resources. Unfortunately, some of those resources are becoming less relevant. I'm still blogging, learning tech and helping others...please find me at my new home on

Wednesday, April 21, 2010

VS2010 Box Selection Trick – Copy and Paste-ery

Here’s a quick tip showing off one of the cool features of box selection in Visual Studio 2010.

This one deals with copy-and-paste.

A simple scenario

Perhaps you are trying to preload some data into a StringBuilder for testing something out. 

As a simple example, let's assume you have a text document with a list of 20 names that you want added to a StringBuilder.

  1. imageIn the method where you wish to build the list, type sb.AppendLine(""); where sb is the name of yourStringBuilder object.
  2. Quickly copy & paste this line 20 times to set up a receiving area for the names.
  3. Open the text file of names in Visual Studio 2010.  This is important because you want to leverage the smarts of the IDE when you copying the text.
  4. Rather than line-selecting the names, box select them with the mouse while holding the ALT key (it's okay if you capture whitespace when the names are longer than others).
  5. Copy the selection to the clipboard.
  6. Return to your method. Vertically box-select the space between the quotes, again by using the mouse to select while holding the ALT key. You get a thin line for a selection that is zero characters wide.
  7. Paste your selection.

Here’s an example of the result:



No comments:

Post a Comment