To automatically format your code in Visual Studio 2005 use the following keyboard shortcuts:
Format Document: CTRL + E, then D
Format Selection: CTRL + E, then F
If you have any syntax errors in your code then the formatting features do not seem to work. So, if you are trying to use the keyboard shortcuts to format a document and it doesn’t seem to be working, then check your code.
The formatting engine is great. You are also able to customize what the format style you want to use for each language you work with. Go to the Tools menu, click Options. Select Text Editor, then the language, for example C#. Expand the node in the tree (C# in this case) and you’ll see either a Format or Formatting child node. Once you select that you’ll see the options available to you.
samham | 06-Nov-06 at 4:13 am | Permalink
this shortcut seems to have 2 versions, while your shortuct works fine at home, it didnt work when trying it at the office(team suite).
The shortcut that worked was ctrl+K,ctrl+D instead of ctrl+E,ctrl+D