Long Data Type (Visual Basic)
Updated: July 20, 2015
For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.
Holds signed 64-bit (8-byte) integers ranging in value from -9,223,372,036,854,775,808 through 9,223,372,036,854,775,807 (9.2...E+18).
Long data type to contain integer numbers that are too large to fit in the
Integer data type.
The default value of
Long is 0.
Interop Considerations. If you are interfacing with components not written for the .NET Framework, for example Automation or COM objects, remember that
Longhas a different data width (32 bits) in other environments. If you are passing a 32-bit argument to such a component, declare it as
Longin your new Visual Basic code.
Furthermore, Automation does not support 64-bit integers on Windows 95, Windows 98, Windows ME, or Windows 2000. You cannot pass a Visual Basic
Longargument to an Automation component on these operating systems.
Longdata type widens to
Double. This means you can convert
Longto any one of these types without encountering a System.OverflowException error.
Type Characters. Appending the literal type character
Lto a literal forces it to the
Longdata type. Appending the identifier type character
&to any identifier forces it to
Framework Type. The corresponding type in the .NET Framework is the System.Int64 structure.