The editor is the word processor of the integrated development environment (IDE). When it is used to edit text, it is referred to as the text editor. When it is used to edit source code in a Visual Studio development language, which is its more common use, it is referred to as the code editor.
You can open multiple code editors to view code in different forms or modules, and you can copy and paste among them. The following table shows various ways to open the code editor.
To open the code editor from
Select a form or module and click the View Code toolbar button, or double-click the form or module.
Windows Forms form or Web Forms form
Select the form or any of its controls and then, on the View menu, click Code. You can also right-click the form and then click View Code. In many cases, double-clicking a component on the design surface also opens the code editor.
Click New or Open to display a code file.
A list of all documents open for editing in instances of the code editor is available on the Windows menu. The HTML Designer, CSS Editor, and XML Editor features of the IDE also employ this editor.
For most development languages, the code editor offers these features:
Access to object properties, methods, and events at design time.
IntelliSense statement completion.
Collapsible code sections.
A Code Definition Window that displays the source code for an object or element.
A Code Snippet Inserter that lets you add ready-made blocks of model code.
Options to define indents, tabs, and drag-and-drop behavior.
Unicode code pages.
- Code pane
The area where code or text is displayed for editing. It provides IntelliSense statement completion for the language in which you are developing. For more information, see Using IntelliSense.
- Indicator margin
A gray column on the left side of the code editor where indicators for breakpoints, bookmarks, and shortcuts are displayed. Clicking this area sets a breakpoint on the adjacent line of code.
- Selection margin
A column between the indicator margin and the editing window where you can click to select lines of code. Changes to code are tracked here when you select the Track Changes option in the Options dialog box. For more information, General, Text Editor, Options Dialog Box.
- Horizontal and vertical scroll bars
Lets you scroll the code pane horizontally and vertically so that you can view the code that extends beyond the viewable edges of the pane.
- Editing Text, Code, and Markup
Contains links to topics about how to configure and use the code editor.
- Customizing the Editor
Provides guidance about how to set text editor options.
- General, Text Editor, Options Dialog Box
Lets you set indent and tab sizes, drag-and-drop behavior, editor emulation, and whether to display the editor margins and scroll bars.
- General, All Languages, Text Editor, Options Dialog Box
Lets you set options that apply to all development languages.
- How to: Manage Code Snippets
Describes how to insert ready-made snippets of code, and how to manage folders in which snippets are stored.
- Editor Convenience Commands and Features
Describes techniques for manipulating text and code in the editor.
- Finding and Replacing
Describes how to use the Find and Replace window and related search tools.
- Setting Bookmarks in Code
Describes techniques for marking particular lines of code and jumping to them.
- Coding Aids
Describes tools for adding and configuring controls, and for browsing through object hierarchies.