CODE COLORING AND HIGHLIGHTING

The code editor displays different types of code items in different colors (although they all appear black or gray in this book). 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.

COLOR CONFUSION
To avoid confusion, you should probably leave the editor’s 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
User-defined types Navy text
Warning Underlined with a wavy green underline

A few other items that may sometimes 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), and numbers.

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 ...

Get Visual Basic 2012 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.