Click here to Skip to main content
15,885,365 members
Articles / Visual Studio
Tip/Trick

Box Editing with VS2010 - Editing multiple lines at once

Rate me:
Please Sign up or sign in to vote.
4.67/5 (3 votes)
27 Apr 2010CPOL 19.7K   1   6
Visual Studio 2010 provides a feature by which it is now possible to edit multiple lines at one go.For e.g. say you have a class which you have three member variables which are declared as private.public class MyClass{ private int myInt; private double myDouble; private...
Visual Studio 2010 provides a feature by which it is now possible to edit multiple lines at one go.

For e.g. say you have a class which you have three member variables which are declared as private.

public class MyClass
{
   private int myInt;
   private double myDouble;
   private string myString;

   ...
}


Now if you want to change the access of these member variables from private to protected, in VS2008 and before you need to select each private word and change it to protected.

In Visual Studio 2010, there is a better alternative to that.

Just press Alt key and perform a vertical selection and select all the three private words. (If you are using the keyboard only, then use the keys Shift + Alt + Arrow keys to select the words.)

Now just type protected once and you will notice that protected is being typed in all the three lines together. Saves a lot of time! :)

C#
public class MyClass
{
   protected int myInt;
   protected double myDouble;
   protected string myString;
   ...
}


Alternatively, you can copy the protected word first and then perform a vertical selection (using Alt key) of all the three private words and paste once. It will paste in all three lines.

Check these links for further reference:

Link 1[^]
Link 2[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
An individual with more than a decade of experience in desktop computing and mobile app development primarily on the Microsoft platform. He loves programming in C#, WPF & XAML related technologies.
Current interests include web application development, developing rich user experiences across various platforms and exploring his creative side.

Ratish's personal blog: wpfspark.wordpress.com

Comments and Discussions

 
GeneralNot new Pin
miies29-Apr-10 2:27
miies29-Apr-10 2:27 
GeneralRe: Not new Pin
Ratish Philip30-Apr-10 3:16
Ratish Philip30-Apr-10 3:16 
GeneralRe: Not new Pin
miies30-Apr-10 9:36
miies30-Apr-10 9:36 
GeneralRe: Not new Pin
Ratish Philip30-Apr-10 16:37
Ratish Philip30-Apr-10 16:37 
GeneralReminds me of PC-Write 3.0 Pin
supercat927-Apr-10 6:36
supercat927-Apr-10 6:36 
GeneralRe: Reminds me of PC-Write 3.0 Pin
Ratish Philip27-Apr-10 15:37
Ratish Philip27-Apr-10 15:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.