Sunday, October 12, 2008

 

Displaying Line Numbers in Visual Studio

You would think that the display of line numbers should just be automatic when using Visual Studio 2005 or 2008. After all when using a C# compiler all the errors are given by a line number. Also when exceptions occur the stack traces gives the line numbers of the stack (procedure calls) and the line number of the offending code that caused the exception. Unfortunately, by default the line numbers are not visible when viewing the code in Visual Studio. In fact many programmers work for months and even years before finding this important setting.

To display line numbering in Visual Studio 2005 or Visual Studio 2008 click the following sequence.

Tools/Options/Text Editor/C#/General and select "Display/Line Numbers".


Visual Studio C# text editor with line numbers off (default). Note no line numbers.


Select the Tools from the main menu bar, then Options.


Select Display/Numbers so that line numbers are displayed.


Visual Studio C# text editor with line numbers turned on. Note the line numbers on left.

Also See Related Postings
Using Regions
C#: Top 10 Coding Guidelines

Labels:


Comments: Post a Comment





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]