VISUAL BASIC 6.0 - DATA TYPES

 

Type

Storage

Range

Byte

1 byte

0 to 255

Integer

2 bytes

-32,768 to 32,767

Long

4 bytes

-2,147,483,648 to 2,147,483,647

Single

8 bytes

-3.402823E+38 to –1.401298E-45 for negative values; 1.401298E-45 to 3.402823E+38 for positive values

Double

8 bytes

-1.79769313486232E+308 to –4.94065645841247E-324 for negative values; 4.94065645841247E-324 to 1.79769313486232E+308 for positive values

Currency

8 bytes

-922,337,203,685,477.5808 to 922,337,203,685,477.5807 (the extra precision ensures that monetary calculations are kept accurate to two decimal places)

Decimal

12 bytes

+/-79,228,162,514,264,337,593,543,950,335 if you use no decimal; +/-7.9228162514264337593543950335 with up to 28 decimal places (the Decimal data type is not fully supported in Visual Basic yet but remains for compatibility with future versions)

String (fixed length)

Length of string

1 to about 65,400 characters

String (variable)

Length + 10 bytes

0 to 2 billion characters

Date

8 bytes

January 1, 100 to December 31, 9999

Boolean

2 bytes

True or False

Object

4 bytes

Any embedded object

Variant (numeric)

16 bytes

Any value as large as Double

Variant (text)

Length plus 22 bytes

Same as variable-length String

 

 

VISUAL BASIC  SUFFIX CHARACTERS FOR LITERALS.

Suffix

Data Type Represented

&

Long

!

Single

#

Double

@

Currency

                             

 

 

When you type a date or time literal, enclose the value between two-pound signs (#).  VB allows virtually any kind of date and time format and they can follow whatever international setting you’re assigned to your PC.  

 

 

 

Add a data-type suffix character to literals to ensure that VB treats the literal as a specific data type.  If  you type –8.3# in a calculation, VB knows that you want –8.3 as a double-precision number with the highest decimal accuracy possible.

 

 

#7:11 pm#

#19:11:22#

#July 4, 1776#

#1-2-2003#

#5-DEC-99#

 


VB Page

HOME