views:

41

answers:

1

So, I've changed my settings in Tools | Options | Text Editor, for All Languages, Basic, and C#, to having Block indenting, and 'Keep tabs'. I've also tried this with Smart indenting too. Now, although once I start editing a file, its auto indentation is done with tabs, when I create a new web form in my ASP.net website, VS2008 insists on creating the initial code with space indentation. So for example, I'll get an aspx.vb file for my new page like so:

Partial Class Admin_Index
    Inherits System.Web.UI.Page

End Class

Note that the 'Inherits' line is SPACE-indented, even though I have the text editor settings set to keep tabs. Is there any way I can make the default created files indented with tabs, not spaces? Or is VS just too stubborn? :-)

By the way, please don't just respond and say this is petty as I can quickly change that one line of indentation to using a tab. I know this, but I have a software team that find it irritating as we have an SVN hook that prevents checkins if there's any space-indentation. It would be very useful if any newly-created files have tab indentation from the start, rather than us having to change it every time.

A: 

If none of the Visual Studio settings work, you could change the template files to have tabs in them. They're found in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\VisualBasic\, in zip files.

Also, you can quickly re-format the currently opened file by pressing Ctrl+K, Ctrl+D (Edit -> Advanced -> Format Document).

Graham Clark