0% found this document useful (0 votes)
35 views

Visual Basic: Numeric Data Type Conversions

Humms
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Visual Basic: Numeric Data Type Conversions

Humms
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Visual Basic

Numeric data type conversions

VB 6.0 VB.NET 2005 to 2010

Unsigned value Signed value Unsigned value Signed value

Boolean 1 bit Boolean

Byte 8 bits Byte SByte

Integer 16 bits Char UShort, UInt16 Short, Int16

Long 32 bits UInteger, UInt32 Integer, Int32

Currency 64 bits ULong, UInt64 Long, Int64

Decimal 128 bits Decimal

Single 32 bits Single

Double Date 64 bits Double

Lossless conversion VB6 only


.NET only
Can lose precision VB.NET 2005+

Lossless according to test Floating point


Can lose precision according to documentation

Notes
Arrow leads from narrow to wide data type.
Follow arrows to find conversions that always succeed.
Conversion along red arrow succeeds, but may lose precision.

Boolean stores a bit but may take more storage space.

Char is not a numeric type but is represented by a 16-byte


unsigned integer.

Decimal is a 96-bit integer with a sign and a scaling factor.

Example: UInt64 converts well to Decimal, but conversion to


Single or Double may lose precision..

©2010 Aivosto Oy
www.aivosto.com

You might also like