Posts tagged 'Basic Editing'

Friday, August 15, 2014

Tip 1.12: How to use the Undo stack on the standard toolbar

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Instead of having to press Ctrl+Z or Ctrl+Y multiple times to undo or redo multiple commands, you can drop down the Undo or Redo button and, starting from the last action, select how many consecutive additional actions you want to undo or redo.



Just make sure the cursor is in a text editor to enable these buttons.

Happy Programming! =)
Posted by Nils-Holger at 1:16 PM with 439 comments.

Thursday, August 14, 2014

Tip 1.11: You can use a keyboard shortcut to uppercase or lowercase a word in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Once again, this tip illustrates that you can save time by using a keyboard shortcut versus having to type out your changes manually.
  • Press Ctrl+Shift+U to make the current character or selected characters uppercase.
  • Press Ctrl+U to make the current character or selected characters lowercase.




Sara Aside

She has to be honest here and say she had to ask around the Visual Studio building to find out under what conditions these commands would be useful. One scenario is where the Caps Lock key is bound to be a control key. For example, you type a word, then press Ctrl+Shift+Left Arrow to select, then use Ctrl+Shift+U to uppercase (instead of having to hold the Shift key down to type the entire word). Or maybe IntelliSense has made her lazy. =D


Happy Programming! =)
Posted by Nils-Holger at 1:37 PM with 445 comments.

Wednesday, August 13, 2014

Tip 1.10: How to transpose characters, words, and lines in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can use three commands for transposing or swapping text in the editor, namely:
  • Press Ctrl+T to transpose a character.
  • Press Ctrl+Shift+T to transpose a word.
  • Press Alt+Shift+T to transpose a line.


In the following example (where the cursor is placed before the "is" on the commented line "now is the time"), she'll apply the three commands to illustrate how text is swapped.



Pressing Ctrl+T swaps "i" and the previous space, creating "// nowi s the time".

Pressing Ctrl+Shift+T swaps "is" and "the", creating "// now the is time".

Pressing Alt+Shift+T swaps the current line with the line below it.

Happy Programming! =)
Posted by Nils-Holger at 12:46 PM with 436 comments.

Tuesday, August 12, 2014

Tip 1.9: You can right-drag code to Move Here or Copy Here

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

The idea for this tip was submitted by a blog reader. She had no clue that this menu item existed.


Select a line of code, and then right-drag that line to anywhere within your editor (or into another editor window). Then you'll get this little menu popup with the options of Move Here, Copy Here, and Cancel.



Sara Aside

She loves it when blog readers give her little tips like these, especially when she never knew they existed. This tip inspired her to start playing the game "Stump the Sara," where she asked blog readers to send her their most obscure IDE tricks. Since she only worked on the Visual Studio Core Team, the tips had to be limited to generic IDE features not tied to any specific language.


Happy Programming! =)
Posted by Nils-Holger at 1:09 PM with 439 comments.

Monday, August 11, 2014

Tip 1.8: You can drag code or text to a new location

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She tends to be more of a keyboard user, probably because she's too lazy to reach all that way for the mouse. When she first saw this functionality, she was surprised because it is just not something she would intuitively think of, but of course it makes complete sense once the "Oh, she hasn't seen that before" feeling wears off.


Select the code block you want to move by holding down the primary mouse button, and then drag the mouse pointer to the desired location. To copy code to the new location, hold down the Ctrl key.



Not impressed? You can also drag code to a different file. Drag the code above the desired file tab, as shown next.



Although you'll get the mouse "can't drop" pointer, the editor will switch to that file. Then just move the mouse pointer down into the file, and you'll see the good ol' "drag and drop" pointer again. Enjoy!

Happy Programming! =)
Posted by Nils-Holger at 1:52 PM with 0 comments.

Sunday, August 10, 2014

Tip 1.7: How to delete horizontal white space at the beginning of a line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She always thought that "white space" was one word, but according to the Visual Studio UI, it is apparently two words. For this tip, she'll let the UI win and call it "white space."


On the Edit–Advanced menu, you'll find the Delete Horizontal White Space command bound to Ctrl+K, Ctrl+^.



To use, put the cursor anywhere in the white space that precedes the line and press Ctrl+K, Ctrl+^. You can also select multiple lines and delete the white space at the beginning of each line.



Happy Programming! =)
Posted by Nils-Holger at 12:42 PM with 437 comments.

Saturday, August 9, 2014

Tip 1.6: You can use Ctrl+L to cut the current line and Ctrl+Shift+L to delete the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ctrl+L cuts the current line, including the end-of-line character (EOL). The command is Edit.LineCut.

Ctrl+Shift+L deletes the current line, including the EOL. The command is Edit.LineDelete.

Here's an example of Ctrl+L being used. In this example, you'll see the cursor before the Console.WriteLine() call.



And after you hit Ctrl+L, the line disappears.



But let's continue on with a bonus tip . . . Shift+Delete cuts the current line, including the EOL, if nothing is selected on the current line. If text is selected, Shift+Delete cuts just that text.

Happy Programming! =)
Posted by Nils-Holger at 1:14 PM with 430 comments.

Friday, August 8, 2014

Tip 1.5: You can use Ctrl+Delete to delete the next word and Ctrl+Backspace to delete the preceding word

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Many of her "Tip of the Day" ideas come from looking through her old test cases. The Ctrl+Delete test case caught her eye because she had completely forgotten about this keyboard shortcut!


Ctrl+Delete deletes the next word the editor finds. The command is Edit.WordDeleteToEnd.

Ctrl+Backspace deletes the previous word. The command is Edit.WordDeleteToStart.



Happy Programming!
Posted by Nils-Holger at 1:16 PM with 448 comments.

Thursday, August 7, 2014

Tip 1.4: You can use Ctrl+W to select the current word

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Press Ctrl+W at any location on a word to select the entire word. You can have the cursor at the end of word and still have it select the current word (instead of the proceeding white space).



If the cursor is in the middle of some white space, defined as two or more spaces, the white space will be selected.

Happy Programming! =)
Posted by Nils-Holger at 12:56 PM with 667 comments.

Wednesday, August 6, 2014

Tip 1.3: You can use Ctrl+Enter to insert a line above and Ctrl+Shift+Enter to insert a line below

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In the following example, note the location of the cursor in the middle of the current line. Pressing Ctrl+Enter inserts a blank line above the current line, and Ctrl+Shift+Enter inserts a blank line below the current line. The cursor moves to the beginning of the new line.



Happy Programming! =)
Posted by Nils-Holger at 12:43 PM with 444 comments.

Tuesday, August 5, 2014

Tip 1.2: How to cycle through the Clipboard ring to paste different things

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog





Sara Aside

For her, this is yet another one of those moments where she exclaims, "Why can't she ever remember this tip?! It would save her so much time! Argh!" But then again, every time she's reminded about this tip, it's like getting a little gift in the mail.


You can cycle through the past 20 items you've either cut or copied onto the Clipboard via Ctrl+Shift+V. Pretty cool, huh?

To illustrate, let's suppose you have two Console.WriteLine() calls and you need to swap the two strings, as shown in the following example:



Start by cutting both strings: "My Love Marathon" first, and "Hello" second. Now go to the first Console. WriteLine() call. When you press Ctrl+Shift+V once inside the parentheses, you'll get the following changes to the code:



Next, move to the second Console.WriteLine() call, and press Ctrl+Shift+V twice in a row. You'll get this:



And you store up to 20 items before the Clipboard cycles, meaning that it'll go back to the first item still recorded on the Clipboard. This is why the feature is called a Clipboard ring.

Happy Programming! =)
Posted by Nils-Holger at 1:05 PM with 440 comments.

Monday, August 4, 2014

Tip 1.1: How to not accidentally copy a blank line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

There's something about her that wants to hit Ctrl+C instead of Ctrl+V whenever she's on a blank line. She just doesn't understand it. So what happens is she copies a blank line, erasing the text she was trying to paste right there. And to her dismay, she hits Ctrl+V and nothing happens. In fact, she sometimes realizes that she has accidentally hit Ctrl+C, so she hits Ctrl+V as fast as she can, thinking she can outrun the editor. But she looses every time.


The option that saved her sanity is found in Tools–Options–Text Editor–All Languages–General. There's a check box called Apply Cut Or Copy Commands To Blank Lines When There Is No Selection. Unchecking this option allows her to press Ctrl+C all she wants on a blank line without losing the content on her clipboard.



Happy Programming! =)
Posted by Nils-Holger at 1:15 PM with 448 comments.

Thursday, December 5, 2013

Tip 1.12: How to use the Undo stack on the standard toolbar

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Instead of having to press Ctrl+Z or Ctrl+Y multiple times to undo or redo multiple commands, you can drop down the Undo or Redo button and, starting from the last action, select how many consecutive additional actions you want to undo or redo.



Just make sure the cursor is in a text editor to enable these buttons.

Happy Programming! =)
Posted by Nils-Holger at 12:38 PM with 652 comments.

Wednesday, December 4, 2013

Tip 1.11: You can use a keyboard shortcut to uppercase or lowercase a word in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Once again, this tip illustrates that you can save time by using a keyboard shortcut versus having to type out your changes manually.
  • Press Ctrl+Shift+U to make the current character or selected characters uppercase.
  • Press Ctrl+U to make the current character or selected characters lowercase.




Sara Aside

She has to be honest here and say she had to ask around the Visual Studio building to find out under what conditions these commands would be useful. One scenario is where the Caps Lock key is bound to be a control key. For example, you type a word, then press Ctrl+Shift+Left Arrow to select, then use Ctrl+Shift+U to uppercase (instead of having to hold the Shift key down to type the entire word). Or maybe IntelliSense has made her lazy. =D


Happy Programming! =)
Posted by Nils-Holger at 12:10 PM with 1059 comments.

Tuesday, December 3, 2013

Tip 1.10: How to transpose characters, words, and lines in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can use three commands for transposing or swapping text in the editor, namely:
  • Press Ctrl+T to transpose a character.
  • Press Ctrl+Shift+T to transpose a word.
  • Press Alt+Shift+T to transpose a line.
In the following example (where the cursor is placed before the "is" on the commented line "now is the time"), she'll apply the three commands to illustrate how text is swapped.



Pressing Ctrl+T swaps "i" and the previous space, creating "// nowi s the time". Pressing Ctrl+Shift+T swaps "is" and "the", creating "// now the is time". Pressing Alt+Shift+T swaps the current line with the line below it.

Happy Programming! =)
Posted by Nils-Holger at 12:03 PM with 466 comments.

Monday, December 2, 2013

Tip 1.9: You can right-drag code to Move Here or Copy Here

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

The idea for this tip was submitted by a blog reader. She had no clue that this menu item existed.


Select a line of code, and then right-drag that line to anywhere within your editor (or into another editor window). Then you'll get this little menu popup with the options of Move Here, Copy Here, and Cancel.



Sara Aside

She loves it when blog readers give her little tips like these, especially when she never knew they existed. This tip inspired her to start playing the game "Stump the Sara," where she asked blog readers to send her their most obscure IDE tricks. Since she only worked on the Visual Studio Core Team, the tips had to be limited to generic IDE features not tied to any specific language.


Happy Programming! =)
Posted by Nils-Holger at 12:47 PM with 450 comments.

Sunday, December 1, 2013

Tip 1.8: You can drag code or text to a new location

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog

Sara Aside

She tends to be more of a keyboard user, probably because she's too lazy to reach all that way for the mouse. When she first saw this functionality, she was surprised because it is just not something she would intuitively think of, but of course it makes complete sense once the "Oh, she hasn't seen that before" feeling wears off.


Select the code block you want to move by holding down the primary mouse button, and then drag the mouse pointer to the desired location. To copy code to the new location, hold down the Ctrl key.



Not impressed? You can also drag code to a different file. Drag the code above the desired file tab, as shown next.



Although you'll get the mouse "can't drop" pointer, the editor will switch to that file. Then just move the mouse pointer down into the file, and you'll see the good ol' "drag and drop" pointer again. Enjoy!

Happy Programming! =)
Posted by Nils-Holger at 11:57 AM with 3 comments.

Saturday, November 30, 2013

Tip 1.7: How to delete horizontal white space at the beginning of a line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She always thought that "white space" was one word, but according to the Visual Studio UI, it is apparently two words. For this tip, she'll let the UI win and call it "white space."


On the Edit–Advanced menu, you'll find the Delete Horizontal White Space command bound to Ctrl+K, Ctrl+^.



To use, put the cursor anywhere in the white space that precedes the line and press Ctrl+K, Ctrl+^. You can also select multiple lines and delete the white space at the beginning of each line.



Happy Programming! =)
Posted by Nils-Holger at 2:46 PM with 660 comments.

Friday, November 29, 2013

Tip 1.6: You can use Ctrl+L to cut the current line and Ctrl+Shift+L to delete the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ctrl+L cuts the current line, including the end-of-line character (EOL). The command is Edit.LineCut. Ctrl+Shift+L deletes the current line, including the EOL. The command is Edit.LineDelete. Here's an example of Ctrl+L being used. In this example, you'll see the cursor before the Console.WriteLine() call.



And after you hit Ctrl+L, the line disappears.



But let's continue on with a bonus tip . . . Shift+Delete cuts the current line, including the EOL, if nothing is selected on the current line. If text is selected, Shift+Delete cuts just that text.

Happy Programming! =)
Posted by Nils-Holger at 12:12 PM with 787 comments.

Thursday, November 28, 2013

Tip 1.5: You can use Ctrl+Delete to delete the next word and Ctrl+Backspace to delete the preceding word

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Many of her "Tip of the Day" ideas come from looking through her old test cases. The Ctrl+Delete test case caught her eye because she had completely forgotten about this keyboard shortcut!


Ctrl+Delete deletes the next word the editor finds. The command is Edit.WordDeleteToEnd. Ctrl+Backspace deletes the previous word. The command is Edit.WordDeleteToStart.



Happy Programming!
Posted by Nils-Holger at 12:01 PM with 437 comments.

Wednesday, November 27, 2013

Tip 1.4: You can use Ctrl+W to select the current word

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Press Ctrl+W at any location on a word to select the entire word. You can have the cursor at the end of word and still have it select the current word (instead of the proceeding white space).



If the cursor is in the middle of some white space, defined as two or more spaces, the white space will be selected.

Happy Programming! =)
Posted by Nils-Holger at 12:12 PM with 443 comments.

Tuesday, November 26, 2013

Tip 1.3: You can use Ctrl+Enter to insert a line above and Ctrl+Shift+Enter to insert a line below

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In the following example, note the location of the cursor in the middle of the current line. Pressing Ctrl+Enter inserts a blank line above the current line, and Ctrl+Shift+Enter inserts a blank line below the current line. The cursor moves to the beginning of the new line.



Happy Programming! =)
Posted by Nils-Holger at 12:45 PM with 443 comments.

Monday, November 25, 2013

Tip 1.2: How to cycle through the Clipboard ring to paste different things

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

For her, this is yet another one of those moments where she exclaims, "Why can't she ever remember this tip?! It would save her so much time! Argh!" But then again, every time she's reminded about this tip, it's like getting a little gift in the mail.


You can cycle through the past 20 items you've either cut or copied onto the Clipboard via Ctrl+Shift+V. Pretty cool, huh? To illustrate, let's suppose you have two Console.WriteLine() calls and you need to swap the two strings, as shown in the following example:



Start by cutting both strings: "My Love Marathon" first, and "Hello" second. Now go to the first Console. WriteLine() call. When you press Ctrl+Shift+V once inside the parentheses, you'll get the following changes to the code:



Next, move to the second Console.WriteLine() call, and press Ctrl+Shift+V twice in a row. You'll get this:



And you store up to 20 items before the Clipboard cycles, meaning that it'll go back to the first item still recorded on the Clipboard. This is why the feature is called a Clipboard ring.

Happy Programming! =)
Posted by Nils-Holger at 12:51 PM with 609 comments.

Sunday, November 24, 2013

Tip 1.1: How to not accidentally copy a blank line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog





Sara Aside

There's something about her that wants to hit Ctrl+C instead of Ctrl+V whenever she's on a blank line. She just doesn't understand it. So what happens is she copies a blank line, erasing the text she was trying to paste right there. And to her dismay, she hits Ctrl+V and nothing happens. In fact, she sometimes realizes that she has accidentally hit Ctrl+C, so she hits Ctrl+V as fast as she can, thinking she can outrun the editor. But she looses every time.


The option that saved her sanity is found in Tools–Options–Text Editor–All Languages–General. There's a check box called Apply Cut Or Copy Commands To Blank Lines When There Is No Selection. Unchecking this option allows her to press Ctrl+C all she wants on a blank line without losing the content on her clipboard.



Happy Programming! =)
Posted by Nils-Holger at 12:24 PM with 641 comments.

Friday, March 29, 2013

Tip 1.13: How to use the mouse wheel for scrolling in all directions

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Did you know that you can press down on the mouse wheel and have it act as a third button? For many applications that have an editor, pressing the mouse wheel displays an icon indicating which directions you can scroll in. Some require holding down the mouse wheel; others don't. In the editor, press the mouse wheel just once and you'll see an icon indicating which directions you can scroll in.



A couple of things to note:
  • The farther away the mouse is from the directional icon, the faster the editor will scroll.
  • Pressing the primary mouse button stops the scroll, but you have to press the button again to move the cursor to the desired location.


Happy Programming! =)
Posted by Nils-Holger at 2:39 PM with 446 comments.

Thursday, March 28, 2013

Tip 1.12: How to use the Undo stack on the standard toolbar

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Instead of having to press Ctrl+Z or Ctrl+Y multiple times to undo or redo multiple commands, you can drop down the Undo or Redo button and, starting from the last action, select how many consecutive additional actions you want to undo or redo.



Just make sure the cursor is in a text editor to enable these buttons.

Happy Programming! =)
Posted by Nils-Holger at 2:30 PM with 432 comments.

Sunday, March 24, 2013

Tip 1.11: You can use a keyboard shortcut to uppercase or lowercase a word in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Once again, this tip illustrates that you can save time by using a keyboard shortcut versus having to type out your changes manually.
  • Press Ctrl+Shift+U to make the current character or selected characters uppercase.
  • Press Ctrl+U to make the current character or selected characters lowercase.




Sara Aside

She has to be honest here and say she had to ask around the Visual Studio building to find out under what conditions these commands would be useful. One scenario is where the Caps Lock key is bound to be a control key. For example, you type a word, then press Ctrl+Shift+Left Arrow to select, then use Ctrl+Shift+U to uppercase (instead of having to hold the Shift key down to type the entire word). Or maybe IntelliSense has made her lazy. =D


Happy Programming! =)
Posted by Nils-Holger at 1:15 PM with 1641 comments.

Saturday, March 23, 2013

Tip 1.10: How to transpose characters, words, and lines in the editor

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



You can use three commands for transposing or swapping text in the editor, namely:
  • Press Ctrl+T to transpose a character.
  • Press Ctrl+Shift+T to transpose a word.
  • Press Alt+Shift+T to transpose a line.
In the following example (where the cursor is placed before the "is" on the commented line "now is the time"), she'll apply the three commands to illustrate how text is swapped.



Pressing Ctrl+T swaps "i" and the previous space, creating "// nowi s the time". Pressing Ctrl+Shift+T swaps "is" and "the", creating "// now the is time". Pressing Alt+Shift+T swaps the current line with the line below it.

Happy Programming! =)
Posted by Nils-Holger at 1:28 PM with 709 comments.

Friday, March 22, 2013

Tip 1.9: You can right-drag code to Move Here or Copy Here

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

The idea for this tip was submitted by a blog reader. She had no clue that this menu item existed.
Select a line of code, and then right-drag that line to anywhere within your editor (or into another editor window). Then you'll get this little menu popup with the options of Move Here, Copy Here, and Cancel.



Sara Aside

She loves it when blog readers give her little tips like these, especially when she never knew they existed. This tip inspired her to start playing the game "Stump the Sara," where she asked blog readers to send her their most obscure IDE tricks. Since she only worked on the Visual Studio Core Team, the tips had to be limited to generic IDE features not tied to any specific language.


Happy Programming! =)
Posted by Nils-Holger at 1:33 PM with 439 comments.

Tuesday, March 19, 2013

Tip 1.8: You can drag code or text to a new location

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She tends to be more of a keyboard user, probably because she's too lazy to reach all that way for the mouse. When she first saw this functionality, she was surprised because it is just not something she would intuitively think of, but of course it makes complete sense once the "Oh, she hasn't seen that before" feeling wears off.


Select the code block you want to move by holding down the primary mouse button, and then drag the mouse pointer to the desired location. To copy code to the new location, hold down the Ctrl key.



Not impressed? You can also drag code to a different file. Drag the code above the desired file tab, as shown next.



Although you'll get the mouse "can't drop" pointer, the editor will switch to that file. Then just move the mouse pointer down into the file, and you'll see the good ol' "drag and drop" pointer again. Enjoy!

Happy Programming! =)
Posted by Nils-Holger at 2:19 PM with 437 comments.

Monday, March 18, 2013

Tip 1.7: How to delete horizontal white space at the beginning of a line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

She always thought that "white space" was one word, but according to the Visual Studio UI, it is apparently two words. For this tip, she'll let the UI win and call it "white space."


On the Edit–Advanced menu, you'll find the Delete Horizontal White Space command bound to Ctrl+K, Ctrl+^.



To use, put the cursor anywhere in the white space that precedes the line and press Ctrl+K, Ctrl+^. You can also select multiple lines and delete the white space at the beginning of each line.



Happy Programming! =)
Posted by Nils-Holger at 2:11 PM with 446 comments.

Sunday, March 17, 2013

Tip 1.6: You can use Ctrl+L to cut the current line and Ctrl+Shift+L to delete the current line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Ctrl+L cuts the current line, including the end-of-line character (EOL). The command is Edit.LineCut. Ctrl+Shift+L deletes the current line, including the EOL. The command is Edit.LineDelete. Here's an example of Ctrl+L being used. In this example, you'll see the cursor before the Console.WriteLine() call.



And after you hit Ctrl+L, the line disappears.



But let's continue on with a bonus tip . . . Shift+Delete cuts the current line, including the EOL, if nothing is selected on the current line. If text is selected, Shift+Delete cuts just that text.

Happy Programming! =)
Posted by Nils-Holger at 1:33 PM with 942 comments.

Saturday, March 16, 2013

Tip 1.5: You can use Ctrl+Delete to delete the next word and Ctrl+Backspace to delete the preceding word

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

Many of her "Tip of the Day" ideas come from looking through her old test cases. The Ctrl+Delete test case caught her eye because she had completely forgotten about this keyboard shortcut!
Ctrl+Delete deletes the next word the editor finds. The command is Edit.WordDeleteToEnd. Ctrl+Backspace deletes the previous word. The command is Edit.WordDeleteToStart.



Happy Programming!
Posted by Nils-Holger at 2:35 PM with 445 comments.

Friday, March 15, 2013

Tip 1.4: You can use Ctrl+W to select the current word

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Press Ctrl+W at any location on a word to select the entire word. You can have the cursor at the end of word and still have it select the current word (instead of the proceeding white space).



If the cursor is in the middle of some white space, defined as two or more spaces, the white space will be selected.

Happy Programming! =)
Posted by Nils-Holger at 2:12 PM with 450 comments.

Thursday, March 14, 2013

Tip 1.3: You can use Ctrl+Enter to insert a line above and Ctrl+Shift+Enter to insert a line below

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



In the following example, note the location of the cursor in the middle of the current line. Pressing Ctrl+Enter inserts a blank line above the current line, and Ctrl+Shift+Enter inserts a blank line below the current line. The cursor moves to the beginning of the new line.



Happy Programming! =)
Posted by Nils-Holger at 2:25 PM with 622 comments.

Wednesday, March 13, 2013

Tip 1.2: How to cycle through the Clipboard ring to paste different things

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

For her, this is yet another one of those moments where she exclaims, "Why can't she ever remember this tip?! It would save her so much time! Argh!" But then again, every time she's reminded about this tip, it's like getting a little gift in the mail.
You can cycle through the past 20 items you've either cut or copied onto the Clipboard via Ctrl+Shift+V. Pretty cool, huh? To illustrate, let's suppose you have two Console.WriteLine() calls and you need to swap the two strings, as shown in the following example:



Start by cutting both strings: "My Love Marathon" first, and "Hello" second. Now go to the first Console. WriteLine() call. When you press Ctrl+Shift+V once inside the parentheses, you'll get the following changes to the code:



Next, move to the second Console.WriteLine() call, and press Ctrl+Shift+V twice in a row. You'll get this:



And you store up to 20 items before the Clipboard cycles, meaning that it'll go back to the first item still recorded on the Clipboard. This is why the feature is called a Clipboard ring.

Happy Programming! =)
Posted by Nils-Holger at 2:40 PM with 2177 comments.

Tuesday, March 12, 2013

Tip 1.1: How to not accidentally copy a blank line

"Visual Studio Tips, 251 ways to improve your Productivity in Visual Studio", courtesy of 'Sara Ford'

Sara Ford's Blog



Sara Aside

There's something about her that wants to hit Ctrl+C instead of Ctrl+V whenever she's on a blank line. She just doesn't understand it. So what happens is she copies a blank line, erasing the text she was trying to paste right there. And to her dismay, she hits Ctrl+V and nothing happens. In fact, she sometimes realizes that she has accidentally hit Ctrl+C, so she hits Ctrl+V as fast as she can, thinking she can outrun the editor. But she looses every time.


The option that saved her sanity is found in Tools–Options–Text Editor–All Languages–General. There's a check box called Apply Cut Or Copy Commands To Blank Lines When There Is No Selection. Unchecking this option allows her to press Ctrl+C all she wants on a blank line without losing the content on her clipboard.



Happy Programming! =)
Posted by Nils-Holger at 3:16 PM with 443 comments.