Partilhar via


Como: Armazenar mais de um valor em uma variável (Visual Basic)

A variable holds more than one value if you declare it to be of a composite data type.

Tipos de dados de composição (Visual Basic) include structures, arrays, and classes. A variable of a composite data type can hold a combination of elementary data types and other composite types. Structures and classes can hold code as well as data.

To hold more than one value in a variable

  1. Determine what composite data type you want to use for your variable.

  2. If the composite data type is not already defined, define it so that your variable can use it.

  3. Declare your variable with a Dim statement.

  4. Follow the variable name with an As clause.

  5. Follow the As keyword with the name of the appropriate composite data type.

Consulte também

Referência

Resumo de tipo de dados (Visual Basic)

Conceitos

Caracteres de tipo (Visual Basic)

Tipos de dados de composição (Visual Basic)

Matrizes no Visual Basic

Outros recursos

Estruturas (Visual Basic)

Objetos e Classes no Visual Basic

Implementação de tipos de dados (Visual Basic)