Integer Types

Now that Booleans have been covered in depth, the next step is to examine the Integer types that are part of Visual Basic. Visual Basic 6.0 included two types of integer values: The Integer type was limited to a maximum value of 32767, and the Long type supported a maximum value of 2147483647.

The .NET Framework added a new integer type, the Short. The Short is the equivalent of the Integer value from Visual Basic 6.0; the Integer has been promoted to support the range previously supported by the Visual Basic 6.0 Long type, and the Visual Basic .NET Long type is an eight-byte value. The new Long type provides support for 64-bit values, such as those used by current 64-bit processors. In addition, each of these types also has two alternative types. In all, Visual Basic supports the nine Integer types described in Table 2-2.

TABLE 2-2: Visual Basic Integer Types

type

allocated memory

minimum value

maximum value

Short

2 bytes

-32768

32767

Int16

2 bytes

-32768

32767

UInt16

2 bytes

0

65535

Integer

4 bytes

-2147483648

2147483647

Int32

4 bytes

-2147483648

2147483647

UInt32

4 bytes

0

4294967295

Long

8 bytes

-9223372036854775808

9223372036854775807

Int64

8 bytes

-9223372036854775808

9223372036854775807

UInt64

8 bytes

0

184467440737095551615

Was this article helpful?

0 0

Post a comment