Remove indentation temporarily for Visual Basic code in Visual Studio 2010


I guess the subject line pretty much says it all… Anyway, I do a lot of documentation on Visual Studio, ASP.NET, Visual Basic, and Visual C#, and I therefore often need to copy code I have created from my development VMs to my Word documents. Now, for blocks of code that is indented in the Code editor in Visual Studio, it is handy to be able to remove the indentation before copying it, but the default set up for Visual Basic prevents this. Turns out it is because it automatically formats the text when you unindent.

Fear not, just click Options on the Tools menu, to open the Options dialog box. In the Options dialog box, in the left pane, expand Text Editor, expand Basic, and then click VB Specific. Clear the Pretty listing (reformatting) of code check box, and click OK.

If you don’t want to turn it back on, you can always resort to using CTRL+K, D to format the open document.

Advertisements