More VS.NET Tips & Tricks - ISerializable - Roy Osherove's Blog

More VS.NET Tips & Tricks

For you keyboard junkies out there:

  • Cut the current line - CTRL+L (Saves you that 'long' HOME,SHIFT+END,CTRL+X)
  • Delete the current line - CTRL+SHIFT+L (Saves you that 'long' HOME,SHIFT+END,DEL)
  • Move to the closing or opening of the current block - CTRL+[

 

  • Here's a nice little macro to turn your selection into a region:

Sub OutlineSelection()

Dim objTextDoc As TextDocument

Dim title As String = InputBox("Enter the title for the outline", "Outline code")

objTextDoc = DTE.ActiveDocument.Object("TextDocument")

objTextDoc.Selection.Insert("#region " & title & vbNewLine, vsInsertFlags.vsInsertFlagsInsertAtStart)

objTextDoc.Selection.Insert(vbNewLine & "#endregion ", vsInsertFlags.vsInsertFlagsInsertAtEnd)

objTextDoc.Selection.SmartFormat()

End Sub

 

Save it in you macro-editor(ALT+F8) .

then go to tools-options->environment-keyboard and find that macro.

Highlight it and select the shortcut youd like to run it from(I use CTRL+M,CTRL+N).

 

  • Outline a text selection for a Standard Non-Code file (My favorite)

sometimes your opening files in the VS.NET editor that are not code files.

You have no outlining support in these files... or do you?

Select some text in the open editor and press CTRL+M,CTRL+H. tada! your selection is now collapsed.

Press CTRL+M,CTRL+U to stop the outlining

Published Thursday, May 01, 2003 2:35 PM by RoyOsherove

Comments

Wednesday, April 30, 2003 10:31 PM by Wes Haggard

# re: More VS.NET Tips & Tricks

I'm a keyboard junkie. I usually use SHIFT-DEL to cut a line of text. Thanks for the tip about the outlining standard files I hadn't come acrossed that one yet. Maybe we should make a list of all the hotkeys that we use because I know a ton of them, but I'm you know some I don't and I know some you don't. Let me know. I doesn't just have to be Visual Studio shortcuts either I know alot of windows shortcuts as well.
Wednesday, April 30, 2003 11:13 PM by Royo

# re: More VS.NET Tips & Tricks

Sounds Great! Your page or mine..? ;)
Wednesday, April 30, 2003 11:16 PM by Royo

# re: More VS.NET Tips & Tricks

btw, there was a good 'vs.net fun facts' page at chris sells' site somewhere, but i can;t find it. Perhpas everything should go in there...
Thursday, May 01, 2003 1:50 AM by Wes Haggard

# re: More VS.NET Tips & Tricks

Chris' VS Fun Facts I have seen these before and he just has them as a post. I was thinking that I could create a story for it and call it "VS Tips and Tricks". We could break it into some sections like: Shortcut keys, Enviroment setups, Addins, External tools, etc.
I will try to start a story tonight with a simple layout.
Thursday, May 01, 2003 3:06 AM by Royo

# re: More VS.NET Tips & Tricks

Cool. I'm sure eveyone would love to chip in :)
Thursday, May 01, 2003 7:35 AM by TrackBack

# VS.Net Tip/Trick : Jason Tucker's Blog

VS.Net Tip/Trick : Jason Tucker's Blog
Friday, August 27, 2004 1:36 AM by TrackBack

# Visual Studio .Net Tips

Friday, August 27, 2004 3:11 AM by TrackBack

# Visual Studio .Net Tips

Visual Studio .Net Tips