Visual Studio IDE – Format Document

19 01 2009




When we write large line of codes it is necessary to keep the readability of the code. The curly braces “{}” should be arranged in proper order, tab spacing should be same for the codes within a pair of opening and closing braces and etc. etc.

In Visual Studio there is a feature called Format Document which will align the code systematically.  There have different methods to do this. I am going to describe one of them.howcanidoit16



The following method mentions how to align the code within a pair of curly braces. For that first of all place the cursor just before or after the one of the curly braces ( “{” or ” }” ). Then press the key combination Ctrl+Shift+}, now the codes enclosing the pair of curly braces become selected. Then press the key combination Alt+F8. Now the code looks pretty organized.right? 🙂

Suppose our code looks like,



Press the key combinations, now the code looks aligned 🙂







If you want to format only a selected section of the code.  Select the  area you want to format and press Alt+F8.




4 responses

6 04 2010
Jerry Ball

Good one, Sanoop!


7 04 2010
Sanoop S P

Thank you Jerry.

10 06 2012

Gracias hermano . desde Perú

27 06 2012
Sanoop S P

You are welcome

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: