TechnologyUK - Programming (VB6) Logo

Data Types

Data types are the foundation of any programming language. Data is information that will be processed by your application, and falls into three broad categories - numeric (integer or floating point numbers), string (text data), and special. A string is a series of zero or more characters that is handled as a single entity. VB supports both fixed and variable-length strings. Controls almost always supply the Variant datatype to applications (the Variant datatype allows you to store data in a variable when you do not know the specific datatype of the variable). You can convert the control's data type to a different data type, either using a conversion routine or through implicit typing (implicit typing is the process that VB performs when converting one datatype to another). The table below lists the datatypes that Visual Basic supports.


Visual Basic Data Types
DatatypeDescription and range
Boolean A datatype that can only take one of two values - True or False. True and False are reserved words in Visual Basic (they cannot be used to name user defined variables, constants or procedures).
Byte A positive integer that can take any value from 0 to 255.
Currency Currency data that holds a value from -£922,337,203,685,477.5808 to £922,337,203,685,477.5807. The four decimal places ensure that proper rounding can occur. VB uses the currency type specified by the International settings in force on the host computer - the currency symbol (£, $ etc.) should not be used when entering Currency values.
Date Holds date and time values. The date can range from January 1, 100, to December 31, 9999.
Double A floating point number that holds a value from -1.79769313486232E+308 to 1.79769313486232E+308. Sometimes known as double-precision.
Integer A signed integer that holds a value from -32,768 to 32,767.
Long A signed integer that holds a value from -2,147,483,648 to 2,147,483,647. Sometimes called a long integer.
Object A special datatype that holds and references objects such as controls and forms.
Single A floating point number that holds a value from -3.402823E+38 to 3.402823E+38. Sometimes known as single-precision.
String A data item that consists of between 0 and 65,400 alphanumeric characters (which can include special characters such as ^, %, and @). Strings can be fixed or variable-length.
Variant Data of any datatype, used for control and other values for which the datatype is unknown.