Udostępnij za pośrednictwem


How to: Get Information about Visual Basic Compiler Errors

Visual Basic compiler errors occur when the compiler encounters problems in the code. The code causing the errors is marked with a wavy line underneath it in the Code Editor, and when your mouse pauses over the marked code, the error message appears. The messages also appear in the Task List.

Getting Help

The Smart Compile Auto Correction feature suggests corrections for some errors and allows you to apply the fix. When an error occurs, if there is a hollow rectangular symbol under the right side of the wavy underline, resting your mouse over the wavy underline or double-clicking the error message in the Task List turns the symbol into a smart tag panel. Clicking or resting your mouse pointer over the smart tag panel opens the Error Correction Options helper window, which displays a description of the error, as well as a set of suggestions for fixing the error. For more information, see How to: Correct Compiler Errors with Auto Correction.

The Visual Basic compiler includes a set of warnings about code that may cause run-time errors. Developers can use that information to write cleaner, faster code with fewer bugs. For example, the compiler produces a warning when the user attempts to invoke a member of an unassigned object variable, return from a function without setting the return value, or execute a Try block with errors in the logic to catch exceptions. To learn more about warnings, including how to turn them on and off, see Configuring Warnings in Visual Basic.

To get help for a particular error message

  1. Highlight the error message in the Task List and press F1.

    -or-

  2. On the Help menu, click Search.

  3. Type the error message in the Search For box in the Search window.

    Note

    Remember that displayed error messages often incorporate identifiers from the code, such as variable or project names, as well as the type names for these elements; these are not part of the underlying error message. Be careful not to include these words as part of your search.

See Also

Tasks

How to: Get Information about Visual Basic Run-Time Errors

How to: Debug Code in the Editor

How to: Correct Compiler Errors with Auto Correction

Concepts

Configuring Warnings in Visual Basic