views:

126

answers:

3

When I type the closing brace in an html page, this i what Visual Studio does. Notice the opening brace is now 1 indent before the foreach. They should be even as shown by the closing brace. Not a big thing but driving me nuts.

<% foreach (var item in Model.Messages)
{ %>
<% } %> 
A: 

In code view press Ctrl+E,D It will auto-format/indent your code.

Dremation
Try Ctrl+K, Ctrl+D ;) http://www.codinghorror.com/blog/files/Visual%20Studio%20.NET%202005%20Keyboard%20Shortcuts.htm
NitroxDM
Visual Studio 2008 / 2010 the shortcut is Ctrl+E,D. Mouse over Edit->Advanced->Format Document
Dremation
In the default settings for 2008 Ctrl+E, D and Ctrl+E, Ctrl+D and Ctrl+K, Ctrl+D run the same command. Learned something new about VS. The ED combination makes more sense then KD. I dig the Ctrl+E, Ctrl+D.
NitroxDM
A: 

Go to Tools -> Options -> Text Editor -> [Pick your language] -> Formatting. You should find something in there.

NitroxDM
A: 

When I try Ctrl+K, Ctrl+D in Visual Studio 2010 Express, it says this key combination is bound to the command (Format document) which is not currently available.

Kamran