This documentation is archived and is not being maintained.

Integer Data Type

Integer variables are stored as signed 32-bit (4-byte) integers ranging in value from -2,147,483,648 through 2,147,483,647.

The Integer data type provides optimal performance on a 32-bit processor, as the smaller integral types are slower to load and store from and to memory.

You can convert the Integer data type to Long, Single, Double, or Decimal without encountering a System.OverflowException error.

Caution   If you are interfacing with components written in Visual Basic version 6.0, for example Automation or COM objects, keep in mind that Integer has a different data width (16 bits) in Visual Basic 6.0. If you are passing a 16-bit argument to such a component, declare it as Short instead of Integer in Visual Basic .NET.

Appending the literal type character I to a literal forces it to the Integer data type. Appending the identifier type character % to any identifier forces it to Integer.

The equivalent .NET data type is System.Int32.

See Also

Data Type Summary | Int32 Structure | Long Data Type | Short Data Type | Type Conversion Functions | Conversion Summary | Integer Data Type Changes in Visual Basic | Efficient Use of Data Types