Megosztás a következőn keresztül:


How to: Display Line Numbers in the Editor

You can toggle line numbering on and off in your code. For more information on finding particular lines of code, see How to: Navigate Code and Text.

Note

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.

Procedure

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

  1. On the Tools menu, select Options.

  2. In the categories list on the left side of the Options window, expand the Text Editor node.

  3. Expand the All Languages subnode and select General to set this option globally.

Note

Visual C# Express user must click Show All Settings to reveal the All Languages subfolder.

—or—

Choose the General options in the subfolder for the language in which you are programming.

  1. In the Display section check the Line numbers checkbox.

See Also

Concepts

Customizing the Editor

Other Resources

Setting Editor Options

Editing Text, Code, and Markup

Change History

Date

History

Reason

July 2008

Clarified procedure.

Customer feedback.