This documentation is archived and is not being maintained.

Managing the Code Editor and View

The Visual Studio Code Editor gives you a number of ways to control the view of your code. Below is information about how to affect these views.

Changing the view mode of the IDE

Visual Studio .NET features an additional new view mode called Tabbed Documents which allows you to have multiple editors and documents open simultaneously and access them through tabs at the top of the Code Editor. As in past versions of Visual Studio, you can alternatively open the environment in MDI (Multiple Document Interface) mode, where the windows are all joined together (but without the tabs), and each window can be tiled, minimized, and so forth.

To switch between IDE view modes

  1. Select Options from the Tools menu.
  2. Select the Environment folder.
  3. In the Settings group box, choose a view mode:
    • Tabbed Documents
    • MDI environment

Creating New Windows

You can create multiple Code Editor windows on a single document so that you can view different parts of it simultaneously. You can also view different parts of the file simultaneously by splitting the pane vertically, but when you create a new window, you can view two different parts of the same file simultaneously in full-sized windows. New to the Visual Studio .NET Code Editor for all languages, you can create a new document window in the environment.

To create a new window

  • On the Window menu, click New Window.

When you do this in Tabbed Documents (default environment) mode, a new tab is added to the Code Editor. In the other mode, a new window displays.

Splitting the View

A Code Editor can be split into two separate parts for easier editing.

To split a pane

  1. Click the splitter bar (located above the scroll bar).
  2. Drag the splitter bar downward.
  3. To go back to a single pane, double-click the splitter bar dividing the two panes.

The new pane contains the same document, and any changes made to it are reflected in the other pane as long as that pane displays the same place in the document.

Word wrap

When you activate Word Wrap by pressing CTRL+R and then CTRL+R again, the horizontal scrollbar is removed and lines of code that exceed the width of the Code Editor's window size automatically wrap to the next displayed line rather than scrolling off the side of the window.

To activate word wrap

  1. Select Options from the Tools menu.
  2. Click Text Editor.
  3. Open the appropriate language folder (or the All Languages folder to affect all languages).
  4. Select Word Wrap. Alternatively, pressing CTRL+R and then CTRL+R again toggles this option.

Enabling Virtual Space mode

In Virtual Space mode, the editor acts as if the space past the end of each line is filled with an infinite number of spaces, allowing code lines to continue off the side of the visible screen area.

To enable Virtual Space mode

  1. Select Options from the Tools menu.
  2. Click Text Editor.
  3. Open the appropriate language folder (or the All Languages folder to affect all languages).
  4. Select Enable Virtual Space.

When Virtual Space mode is not enabled, the cursor wraps from the end of one line to the first character of the next line and vice-versa.

Note   Virtual Space mode is active whenever you are in Column Selection mode.

Displaying Line Numbers

You can turn on line numbering in your code. Line numbers are useful for, for example, Navigating Code and Text.

Note   Turning on line numbering does not mean that the document will print with line numbers. For line numbers to print, you must select the Line numbers check box in the Page Setup command on the File menu.

To display line numbers in code

  1. Select Options from the Tools menu.
  2. On the Text Editor node, choose All Languages.
  3. In the Display group box on the General node, click Line Numbers.
  4. To select this option on a programming language basis, select Line Numbers in the appropriate folder. For example, to set line numbers for Visual Basic .NET, select Line Numbers in the Display group box in the Basic node.

Enabling Full Screen mode

You can choose to hide all tool windows and view only document windows by enabling Full Screen mode.

To enable Full Screen mode

  • Press ALT+SHIFT+ENTER to enter or exit Full Screen mode. Alternatively, you can issue the command View.Fullscreen in the Command window.

Additional view options

There are other ways to affect the view of your code or text:

  • Outlining to see the structure of a file and navigate to code definitions

    You can use the command CollapseToDefinitions to create an outline view of the code. You can, for example, collapse all of the function bodies in a class, collapse the body of the class, and collapse the namespace in which the class is defined. This allows you to get a quick overall view of the code and expand definitions of only the particular functions you want to work on. For more information about this, see Outlining and Hiding Code.

  • Fonts and size

    You can change the fonts and colors that display in the Editor, as well as how it appears when printed. For more information about this, see Code and Text Printing Issues.

See Also

Editing Code, HTML, and Text