How to Change the Default Code Indention Settings in VisualStudio.Net

Posted by

by Misty S Bledsoe

Keeping your tab indents uniform will enhance code readability. //Photo courtesy of mantasmagorical/Morguefile.com

Keeping your application’s programming code uniform while writing computer code for yourself or for an enterprise operation is important to keep readability simple and uniformed. Each company has their own rules that may determine certain settings when it comes to programming such as naming conventions, comment requirements and layout requirements. Setting the default code indention in Visual Studio.NET will prevent you from making indentation mistakes while programming and keep your code easier to read.

  1. Open VisualStudio.NET. You’ll see the VisualStudio’s starting page. Ignore the information.
  2. Navigate to the top where you see the menu choices of “File,” “Edit,” “View,” “Tools,” “Test,” “Window” and “Help.” Click on “Tools.”
  3. Scroll down to the last option called “Options” and click on it. This populates another window with several choices both in a left hand column and in a right hand column.
  4. Select the arrow next to “Text Editor.” If you want to make these changes for all languages, click on “All Languages.” If you want to only change it for one specific language, then click on the language you want to change it for.
  5. Click on “Tabs.” Select “Insert spaces” to make sure it is checked. Enter the same number for both “Tab size” and “Indent size.”
  6. Click “OK” and close the dialog window. VisualStudio.NET will now use that number of indentation for each new level of code as you program automatically.

Consider commenting in the beginning of your code that you’ve pre-set the indentation levels for your code as part of good comment habits. It may seem inconsequential to you as the programmer, but if your code is passed on to others in the organization and you are no longer available to maintain the code, having this comment in your code will tell the new person how that portion of your code is set up. It is not necessary to change the default settings in VisualStudio.NET for the purposes of indentation. The option is there to comply with business needs and increase readability. 

0 Comments on How to Change the Default Code Indention Settings in VisualStudio.Net

Respond | Trackback

Respond

Comments

Comments