Compartilhar via


Mensagens de erro (Visual Basic)

Mensagens de erro podem ocorrer enquanto um aplicativo é executado, dentro do ambiente de Visual Basic ou como um arquivo de sozinho executável stand-. Algumas delas também podem ocorrer durante a criação do tempo ou compilar .

Para obter recursos que você pode usar para ajudar a solucionar um erro, consulte Recursos Adicionais para Programadores Visual Basic.

Run Time Errors

Visual Basic run-time errors occur when an application attempts to perform an action that the system cannot execute.

Os erros que Visual Basic lança é Exception objetos. Visual Basicpode gerar erros personalizados de qualquer tipo de dados, incluindo Exception objetos, usando o Throw demonstrativo. A program can display the error number and message of a caught exception to identify the error. If an error is not caught, the program ends.

Run-time errors can be trapped and examined by the code. By enclosing the code that produces the error in a Try block, any thrown error can be caught within a matching Catch block.

Para obter informações sobre erros em tempo de execução e respondê-las em seu código, consulte Tratamento de Exceção e Erro no Visual Basic.

Errosem Horade compilação.

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.

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 Como: Corrigir erros do compilador com correção automática de (Visual Basic).

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 Configurando Avisos (Warnings) no Visual Basic.