Delen via


Long Data Type (Visual Basic)

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).

Remarks

Use the 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.

Programming Tips

  • Interop Considerations. If you are interfacing with components not written for the .NET Framework, for example Automation or COM objects, remember that Long has a different data width (32 bits) in other environments. If you are passing a 32-bit argument to such a component, declare it as Integer instead of Long in 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 Long argument to an Automation component on these operating systems.

  • Widening. The Long data type widens to Decimal, Single, or Double. This means you can convert Long to any one of these types without encountering a System.OverflowException error.

  • Type Characters. Appending the literal type character L to a literal forces it to the Long data type. Appending the identifier type character & to any identifier forces it to Long.

  • Framework Type. The corresponding type in the .NET Framework is the System.Int64 structure.

See Also

Reference

Data Type Summary (Visual Basic)

Int64

Integer Data Type (Visual Basic)

Short Data Type (Visual Basic)

Type Conversion Functions (Visual Basic)

Conversion Summary (Visual Basic)

Concepts

Efficient Use of Data Types (Visual Basic)