Compartilhar via


Constantes e Enumerações (Visual Basic)

Visual Basic supplies a number of predefined constants and enumerations for developers. Constants store values that remain constant throughout the execution of an application. Enumerations provide a convenient way to work with sets of related constants, and to associate constant values with names.

Constants

Conditional Compilation Constants

The following table lists the predefined constants available for conditional compilation.

Constant

Description

CONFIG

A string that corresponds to the current setting of the Active Solution Configuration box in the Configuration Manager.

DEBUG

A Boolean value that can be set in the Project Properties dialog box. By default, the Debug configuration for a project defines DEBUG. When DEBUG is defined, Debug class methods generate output to the Output window. When it is not defined, Debug class methods are not compiled and no Debug output is generated.

TARGET

A string representing the output type for the project or the setting of the command-line /target option. Os valores possíveis de TARGET são:

  • "winexe" para um aplicativodo Windows.

  • "exe" para um aplicativodo console.

  • "biblioteca" para uma classe biblioteca.

  • "módulo" para um módulo.

  • O /target opção pode ser definida na Visual Studio ambientede desenvolvimento integrado. For more information, see /target (Visual Basic).

TRACE

A Boolean value that can be set in the Project Properties dialog box. By default, all configurations for a project define TRACE. When TRACE is defined, Trace class methods generate output to the Output window. When it is not defined, Trace class methods are not compiled and no Trace output is generated.

VBC_VER

Um número que representa o Visual Basic versão, na principais.secundária formato. O número de versão Visual Basic 2005 é a 8.0.

When you call print and display functions, you can use the following constants in your code in place of the actual values.

Constant

Description

vbCrLf

Combinação de caracteres de retorno/alimentação de linha de carro.

vbCr

Caractere de retorno de carro.

vbLf

Linefeed character.

vbNewLine

Newline character.

vbNullChar

Caractere nulo.

vbNullString

Not the same as a zero-length string (""); used for calling external procedures.

vbObjectError

Error number. User-defined error numbers should be greater than this value. For example:

Err.Raise(Number) = vbObjectError + 1000

vbTab

Tab character.

vbBack

Backspace character.

vbFormFeed

Não é usado no Microsoft Windows.

vbVerticalTab

Not useful in Microsoft Windows.

Enumerations

The following table lists and describes the enumerations provided by Visual Basic.

Enumeration

Description

AppWinStyle

Indicates the window style to use for the invoked program when calling the Shell function.

AudioPlayMode

Indicates how to play sounds when calling audio methods.

BuiltInRole

Indica o tipo de função para verificar quando chamar o IsInRole método.

CallType

Indicates the type of procedure being invoked when calling the CallByName function.

CompareMethod

Indicates how to compare strings when calling comparison functions.

DateFormat

Indicates how to display dates when calling the FormatDateTime function.

DateInterval

Indicates how to determine and format date intervals when calling date-related functions.

DeleteDirectoryOption

Specifies what should be done when a directory that is to be deleted contains files or directories.

DueDate

Indicates when payments are due when calling financial methods.

FieldType

Indicates whether text fields are delimited or fixed-width.

FileAttribute

Indicates the file attributes to use when calling file-access functions.

FirstDayOfWeek

Indicates the first day of the week to use when calling date-related functions.

FirstWeekOfYear

Indicates the first week of the year to use when calling date-related functions.

MsgBoxResult

Indicates which button was pressed on a message box, returned by the MsgBox function.

MsgBoxStyle

Indicates which buttons to display when calling the MsgBox function.

OpenAccess

Indicates how to open a file when calling file-access functions.

OpenMode

Indicates how to open a file when calling file-access functions.

OpenShare

Indicates how to open a file when calling file-access functions.

RecycleOption

Specifies whether a file should be deleted permanently or placed in the Recycle Bin.

SearchOption

Specifies whether to search all or only top-level directories.

TriState

Indicates a Boolean value or whether the default should be used when calling number-formatting functions.

UICancelOption

Specifies what should be done if the user clicks Cancel during an operation.

UIOption

Specifies whether or not to show a progress dialog when copying, deleting, or moving files or directories.

VariantType

Indicates the type of a variant object, returned by the VarType function.

VbStrConv

Indicates which type of conversion to perform when calling the StrConv function.

Consulte também

Conceitos

Visão geral sobre constantes (Visual Basic)

Visão geral de enumerações (Visual Basic)

Outros recursos

Referência de linguagem do Visual Basic

Visual Basic