Visual Studio 2010–New and little-know features–Part 1–Column selection

Table of Contents for this series.


One of the really cool, productivity-boosting but little-known features in the Visual Studio IDEs (since VS 2005) is the Column selection (aka Box selection) feature. 

Everyone is familiar with the standard Line selection (aka Stream selection) that is achieved by dragging the mouse cursor horizontally to select contiguous characters on a line.  Dragging vertically would select the remainder of the current line prior to selecting the next line down, like so. (For the mouse-impaired, aka keyboard junkies, this is done by using SHIFT + Arrow Keys)

                       Figure 1: Standard line (stream) selection

What many developers don’t realize is that Visual Studio also has a variant of this behavior called Column or Box Selection.

With Column Selection I’m able to select a vertical portion of a set of lines without taking the remainder of each line. My selection can start anywhere and extend anywhere within the file.  This is achieved by holding down the ALT key while performing a vertical drag around the area of text to select. (For our keyboard junkies, this would be SHIFT + ALT + Arrow keys)


Once I’ve made a selection, the editor will allow me to change all of the selected text on each line to the same value just by typing in the new text. 

If I want to change all of those variables from public to private, all I now have to do is begin typing p-r-i-v-a-t-e and the selected part of each line will change to the typed entry.


Notice that I don’t get IntelliSense while making this change, but I’m ok with that since is saves me so much time.