Types of Variables in Visual Basic 6

Spread the love

The possible variable types and their ranges :

 

Variable typeBytes of StorageRange
Boolean1True or False
Byte10 to 255
Currency8-922,337,203,685,477.5808 to 922,337,203,685,477.5807
Date81 January 100 to 31 December 9999 and times from 0:00:00 to 23:59:59
Decimal12-79,228,162,514,264,337,593,543,950,335 to 79,228,162,514,264,337,593,543,950,335
Double8-1.79769313486232E08 to 4.94065645841247E-324 for negative values and from 4.94065645841247E-324 to 1.79769313486232E08 for positive values
Integer2-32,768 to 32,767
Long4-2,147,483,648 to 2,147,483,647
Object4N/A
Single4-3.402823E38 to -1.401298E-45 for negative values and from 1.401298E-45 to 3.402823E38 for positive values
StringN/AA 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 typeN/AN/A
VariantN/AN/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.