How to: Display Line Numbers in the Editor

You can display or hide line numbering in your code.


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.

Display Line Numbers in Code

Line numbers aren't added to your code; they're for reference only. For line numbers to print, you must open the Print dialog box, and then 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, then select either All Languages (to turn on line numbers in all languages) or the node for the language you are using. Or you can type line number in the Quick Launch window.


    Visual Studio Express editions for specific languages have options only for that language.

  2. Options for displaying line numbers in the editor


Depending on your language or settings, 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.

See Also


Customizing the Editor

Other Resources

Text Editor Options Dialog Box

Writing Code in the Code and Text Editor