views:

362

answers:

3

I get that you can select a vertical block in Visual Studio 2008 (alt-drag), but I don't understand how you use it once it's selected.

How do you:

  1. Move the selection point inside the block and have the text you're typing get inserted on every line simultaneously?
  2. Move the block one space to the right/left

Or can you just copy/delete the selection? I assumed when I saw the ability to select that it was something like TextMate's vertical blocks, but maybe it's just not as advanced as that.

New behavior (as of VS2010 RC - added 13 Feb 2010):

  • You can now type in the selection and have the same thing show up on every line.
  • Tab moves the selected block
A: 

I think it's pretty much just for copy/cut/delete. If I'm wrong, and it has more functionality, I'd be glad to hear about it.

Bob King
+1  A: 

The first thing I can think of is when I have a group of UI controls and a database - e.g. - this pattern in the PageLoad():

Field1.Text = xxx;
Field2.Text = xxx;
Field3.Text = xxx;
Field4.Text = xxx;
Field5.Text = xxx;

And some place that I need to paste them. For example, in a Button handler where I want to save the values.

DBCommand.AddWithValue("", );
DBCommand.AddWithValue("", );
DBCommand.AddWithValue("", );
DBCommand.AddWithValue("", );
DBCommand.AddWithValue("", );

I'd use a block copy to pull the fields into the target (here I'd be pasting to the value).

Mark Brittingham
A: 

When you copy-paste code from the Internet, the code often has line numbers or '>' or some other HTML prefixed to every line of the code which can be a pain while compiling. That's one area to use it.

Disclaimer: No, I am not giving you ideas on my coding skills ;-)

dirkgently