Types of Variables in Visual Basic 6

Spread the love

The possible variable types and their ranges :

 

Variable type Bytes of Storage Range
Boolean 1 True or False
Byte 1 0 to 255
Currency 8 -922,337,203,685,477.5808 to 922,337,203,685,477.5807
Date 8 1 January 100 to 31 December 9999 and times from 0:00:00 to 23:59:59
Decimal 12 -79,228,162,514,264,337,593,543,950,335 to 79,228,162,514,264,337,593,543,950,335
Double 8 -1.79769313486232E08 to 4.94065645841247E-324 for negative values and from 4.94065645841247E-324 to 1.79769313486232E08 for positive values
Integer 2 -32,768 to 32,767
Long 4 -2,147,483,648 to 2,147,483,647
Object 4 N/A
Single 4 -3.402823E38 to -1.401298E-45 for negative values and from 1.401298E-45 to 3.402823E38 for positive values
String N/A A variable-length string can contain up to approximately 2 billion characters; a fixed-length string can contain 1 to approximately 64K characters.
User-defined data type N/A N/A
Variant N/A N/A

We can define a variable: Dim varName As varType

Where varName is the name of variable and varType is the type of variable. If we don’t define the type of variable then it will the variant type variable.