Visual Basic Data types
Data is information that will be processed by your application, and broadly speaking can be categorised as being numeric, character-based (i.e. alpha-numeric characters or strings) or a collection of attributes that represent various kinds of object.
Variables are memory locations that hold the data values assigned to them at any given time. Each variable has a name, an address in memory, and a size (usually measured in bytes) that determines the amount of memory it occupies. The variable's size is dependent on its data type. The size of a standard ASCII character variable, for example, is 1 byte.
The table below lists the numeric data types supported by Visual Basic.
|Short||16||Signed (short) integer||-32,768||32,767|
|UShort||16||Unsigned (short) integer||0||65,535|
|Long||64||Signed (long) integer||-9,223,372,036,854,775,808||9,223,372,036,854,775,807|
|ULong||64||Unsigned (long) integer||0||18,446,744,073,709,551,615|
|Single||32||Single-precision floating point number||-3.4028235E38||3.4028235E38|
|Double||64||Double-precision floating point number||-1.79769313486231E308||1.79769313486231E308|
|Decimal||128||Decimal number *||-7.92E+28||7.92E+28|
* Values depend on whether or not a decimal point is used and if so how many places to the right of the decimal point (up to a maximum of 28) are used. For example, if all 28 places are used, the range of values that can be represented is -7.9228162514264337593543950335 to 7.9228162514264337593543950335.
The table below lists some of the non-numeric data types supported by Visual Basic.
|Boolean||A data type that can only evaluate to True (non-zero) or False (zero).|
|Char||A Unicode character code in the range 0 to 65,535.|
|String||A sequence of zero or more unsigned 16-bit code points (character codes) that can range in value from 0 to 65535. Each code point represents a single Unicode character. A string can contain from zero to approximately two billion (231) Unicode characters.|
|Date||Can hold 64-bit DateTime values in the range 0:00:00, January 1 of the year 0001 to 23:59:5999999, December 31 of the year 9999. Each increment represents 100 nanoseconds of elapsed time since the beginning of January 1 of the year 1 in the Gregorian calendar. The maximum value represents 100 nanoseconds before the beginning of January 1 of the year 10000.|
|Object||A variable of type object can store any data type. Objects are referenced using 32-bit pointer variable or or a 64-bit pointer variable, depending on whether the code is running on a 32-bit or a 64-bit platform.|