The primitive types are identified through keywords, which are primitive for predefined structure types in the System
namespace. An primitive type and the structure type it aliases are completely indistinguishable. In other words, writing the reserved word Byte
is exactly the same as writing System.Byte
.
Because aprimitive type aliases a structure type, every primitive type has members. For example, Integer
has the members declared in System.Int32
. Literals can be treated as instances of their corresponding types.
The primitive types differ from other structure types in that they permit certain additional operations:
123I
is a literal of type Integer
.Visual Basic 7.0 defines the following primitive types:
Byte
(1-byte unsigned integer), Short
(2-byte signed integer), Integer
(4-byte signed integer), and Long
(8-byte signed integer). These types map to System.Byte
, System.Int16
, System.Int32
, and System.Int64
, respectively. The default value of an integral type is equivalent to the literal 0
.Single
(4-byte floating point) and Double
(8-byte floating point). These types map to System.Single
and System.Double
, respectively. The default value of a floating-point type is equivalent to the literal 0.0
.Decimal
type (12-byte decimal value), which maps to System.Decimal
. The default value of decimal is equivalent to the literal 0@
.Boolean
data type, which represents a truth-value, typically the result of a relational or logical operation. The literal is of type System.Boolean
. The default value of the Boolean
type is equivalent to the literal False
.Date
data type, which represents a date and/or a time and maps to System.DateTime
. The default value of the Date
type is equivalent to the literal # 01/01/0001 12:00:00AM #
Char
data type, which represents a single Unicode character and maps to System.Char
. The default value of the Char
type is equivalent to the literal ""C
.It is important note is that signed bytes and unsigned integral types are not supported in Visual Basic 7.0. As a result, there are four value types in the type system that are illegal to use in a program: System.SByte
, System.UInt16
, System.UInt32
and System.UInt64
. Any reference to these types will generate an error.
Boolean
| Date
| Char
Decimal
Byte
| Short
| Integer
| Long
Single
| Double