Dela via


Miscellaneous Data Types (Visual Basic)

Visual Basic supplies several data types that are not oriented toward numbers or characters. Instead, they deal with specialized data such as yes/no values, date/time values, and object addresses.

For a table showing a side-by-side comparison of the Visual Basic data types, see Data Type Summary (Visual Basic).

Boolean Type

The Boolean Data Type (Visual Basic) is an unsigned value that is interpreted as either True or False. Its data width depends on the implementing platform. If a variable can contain only two-state values such as true/false, yes/no, or on/off, declare it as Boolean.

Date Type

The Date Data Type (Visual Basic) is a 64-bit value that holds both date and time information. Each increment represents 100 nanoseconds of elapsed time since the beginning (12:00 AM) of January 1 of the year 1 in the Gregorian calendar. If a variable can contain a date value, a time value, or both, declare it as Date.

Object Type

The Object Data Type is a 32-bit address that points to an object instance within your application or in some other application. An Object variable can refer to any object your application recognizes, or to data of any data type. If a variable stores a pointer to an instance of a class that you do not know at compile time, or if it can point to data of various data types, declare it as Object.

See Also

Tasks

Troubleshooting Data Types (Visual Basic)

How to: Hold True and False Values in a Variable (Visual Basic)

How to: Hold Date and Time Values in a Variable (Visual Basic)

How to: Hold Data of Unknown Type in a Variable (Visual Basic)

Concepts

Type Characters (Visual Basic)

Numeric Data Types (Visual Basic)

Character Data Types (Visual Basic)

Other Resources

Elementary Data Types (Visual Basic)