How to: Display Line Numbers in the Editor
Use the following procedure to display line numbers in your code. For more information on finding particular lines of code, see How to: Navigate Code and Text.
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.
Line numbers are not added to your code; they are for reference only. For line numbers to print, you must select Include line numbers in the Print dialog box. For more information, see How to: Print Code in the Editor.
To display line numbers in code
On the menu bar, choose Tools, Options.
In the categories list on the left side of the Options window, expand the Text Editor node.
Perform one of the following steps:
To set this option globally, expand the All Languages subfolder.
Depending on your language or setttings, you may also need to select the Show All Settings check box in the Options window to reveal the All Languages subfolder that this procedure mentions.
To set this option for a specific language such as Basic, C#, F#, open the subfolder for that language.
Choose the General option.
In the Display section, choose Line numbers.