0 minute read
This is one of those things that I can never find — I know it’s there somewhere, but it isn’t where I expect it. Formatting your code ensures standardized usage of indentations and spaces. It also adds and removes lines near the brace characters that delimit code blocks. This is especially useful if you find a great code snippet on the Web, paste it into your code, and then it looks all higgledy-piggledy.
To reformat your code, go to the Edit menu, Advanced, and choose either Format Document (Ctrl-E, D) or Format Selection (Ctrl-E, F). The screen shot below is from Visual Studio 2008, but the functionality is basically the same in previous versions. There are quite a few other useful text formatting options there as well.