Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Edit multiple lines in Visual studio 2017 at once

I'm following a series of videos on Youtube on how to develop a dashboard using bootstrap. The developer in that series uses the Sublime Text editor.

I've noticed that sometimes he clicks on multiple places (one after another) then start typing, and whatever he's typing appears on all these places. I think that saves a lot of time.

In VS and SSMS, one can press ALT then select a rectangle that will be modified. But this one is different as you can just select randomly several places, then start typing.

Do we have the same functionality in Visual Studio 2017?

like image 801
Richard77 Avatar asked Mar 16 '17 14:03

Richard77


People also ask

How do you edit multiple lines in visual studio?

As of the current version, alt+click works!

How do you edit multiple lines in VS code at the same time?

Select the lines you want and then press: Windows: Shift + Alt + i. Mac: shift + option + i.

How do you edit all lines at once?

What you do put your cursor where you want to add a character on a line, then use SHIFT+ALT and either the arrow keys or your mouse (you have to click to the same column position the line that you are selecting to) to select all the lines that you want to edit the same way.

How do I edit multiple lines of code in Visual Studio?

Here’s a quick tip if you’ve ever wanted to edit multiple lines of code at once in Visual Studio. Simply position your cursor at a point in your code, then press and hold SHIFT and ALT. Next, press the up or down arrow to select the lines you want to edit.

How to apply the same change to multiple lines of text?

This is very useful to apply the same change to multiple lines. For instance when you want to add the modifier to multiple properties. Press Alt while selecting the block with the mouse: Press Alt+Shift+Arrow to select the block to edit: If you want to edit multiple places that are unaligned, you can use the multi-cursor edit.

How do I change the Order of lines in Visual Studio 2019?

As of the current version, alt+click works! You can use Shift + Alt while left clicking, but that will only be good for multiple lines selection The question might be dated but in Visual Studio 2019 while holding down click the lines that you want to change and it works as you wanted. As @besthost and @Noel Nemeth commented, you can use ALT + SHIFT

How do I edit multiple lines in a block in Python?

This approach overwrites the selected block. If you want to edit multiple lines in non aligned blocks you need to press Ctrl+Alt and explicitly click where you want each cursor to be and then just start typing as in example 2 below. With this approach you only add new code not overwrite existing code.


2 Answers

You can use Shift+Alt while left clicking, but that will only be good for multiple lines selection

like image 120
besthost Avatar answered Sep 27 '22 23:09

besthost


The question might be dated but in Visual Studio 2019 while holding down

Ctrl + Alt

click the lines that you want to change and it works as you wanted.

like image 25
iCould7 Avatar answered Sep 27 '22 23:09

iCould7