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 some of the data types supported by Visual Basic .NET.

Visual Basic Data Types
Data typeSize (bytes) Description and range
Byte1An unsigned integer that holds a value from 0 to 255
SByte1A signed integer that holds a value from -128 to 127
Short2A signed integer that holds a value from -32,768 to 32,767
UShort2An unsigned integer that holds a value from 0 to 65,535
Integer4A signed integer that holds a value from -2,147,483,648
to 2,147,483,647
UInteger4An unsigned integer that holds a value from 0 to
4,294,967,295
Long8A signed long integer that holds a value from
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
ULong8An unsigned long integer that holds a value from 0 to
18,446,744,073,709,551,615
Single4A single-precision floating point number that holds a value
from -3.4028235E38 to 3.4028235E38
Double8A double-precision floating point number that holds a value
from -1.79769313486231E308 to 1.79769313486231E308
Decimal16A decimal number that holds a value from 0 to + or
- 79,228,162,514,264,337,593,543,950,335 (+ or - 7.9...E+28)
with no decimal point, or 0 to + or -
7.9228162514264337593543950335 with 28 places to the
right of the decimal point
Char2Any Unicode symbol in the range 0 to 65,535
Stringvariable Usually 16-bits per character, 0 to approximately 2 billion
16-bit Unicode characters
Boolean2A data type that can only evaluate to True (non-zero) or
False (zero)
Date8January 1st 0001 to December 31st 9999
Object4Any data type can be referenced by a pointer variable of
type Object