How to: Display Line Numbers in the Editor

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see How to: Display Line Numbers in the Editor on docs.microsoft.com. You can display or hide line numbering in your code.

System_CAPS_ICON_note.jpg Note

Depending on your active settings, the dialog boxes and menu commands that appear might differ from the ones that are described here. To change your settings, open Tools / Import and Export Settings. For more information, see Customizing Development Settings in Visual Studio.

Line numbers aren't added to your code; they're just for reference. If you want line numbers to print, in the Print dialog box, select the Include line numbers check box.

To display line numbers in code

  1. On the menu bar, choose Tools, Options. Expand the Text Editor node, and then select either the node for the language you are using, or All Languages to turn on line numbers in all languages. Or you can type line number in the Quick Launch box.

  2. Options for displaying line numbers in the editor

System_CAPS_ICON_note.jpg Note

Depending on your language or settings, you may have to select the Show All Settings check box in the Options dialog box to reveal the All Languages sub-node.

Customizing the Editor
Text Editor Options Dialog Box
Writing Code

Show: