Datasheet

Code Coloring and Highlighting
The code editor displays different types of code items in different colors. You can change the colors used
for different items by selecting the Tools menu’s Options command, and opening the Environment
Fonts and Colors option page. To avoid confusion, however, you should probably leave the colors alone
unless you have a good reason to change them.
The following table describes some of the default colors that the code editor uses to highlight different
code elements.
Item Highlighting
Comment Green text
Compiler error Underlined with a wavy blue underline
Keyword Blue text
Other error Underlined with a wavy purple underline
Preprocessor keyword Blue text
Read-only region Light gray background
Stale code Purple text
User types Navy text
Warning Underlined with a wavy green underline
A few other items that may be worth changing have white backgrounds and black text by default. These
include identifiers (variable names, types, object properties and methods, namespace names, and so forth),
numbers, and strings.
When the code editor finds an error in your code, it highlights the error with a wavy underline. If you
hover over the underline, the editor displays a tooltip describing the error. If Visual Studio can guess
what you are trying to do, it adds a small flat rectangle to the end of the wavy error line to indicate that
it may have useful suggestions.
The assignment statement
i = “12” shown in Figure 1-59 has an error because it tried to assign a string
value to an integer variable and that violates the Option Strict On setting. The editor displays the wavy
error underline and a suggestion indicator because it knows a way to fix this error. The Error List win-
dow at the bottom also shows a description of the error.
If you hover over the suggestion indicator, the editor displays a tooltip describing the problem and an error
icon. If you click the icon, Visual Studio displays a dialog box describing the error and listing the actions
that you may want to take. Figure 1-60 shows the suggestion dialog box for the error in Figure 1-59. If you
click the text over the revised sample code, or if you double-click the sample code, the editor makes the
change.
62
Part I: Getting Started
37055c016.qxd 4/8/07 12:46 PM Page 62