Visual Basic .NET Data Types - dummies

By Richard Mansfield

Part of Visual Basic.NET All-in-One Desk Reference For Dummies Cheat Sheet

Visual Basic .NET (VB .NET) lets you get right to the basics without having to wade through translators. The following table shows you the data types VB .NET uses, as well as their CLR structure, storage size, and value ranges. Use the info for good, not evil!

Visual Basic Type Common Language Runtime Type Structure Storage Size Value Range
Boolean System.Boolean 2 bytes True or False
Byte System.Byte 1 byte 0 to 255 (unsigned)
Char System.Char 2 bytes 0 to 65535 (unsigned)
Date System.DateTime 8 bytes January 1, 0001 to December 31, 9999
Decimal System.Decimal 16 bytes +/-79,228,162,514,264,337,593,543,950,335 with no decimal
point; +/-7.9228162514264337593543950335 with 28 places to the
right of the decimal; smallest non-zero number is
Double (double- precision floating-point) System.Double 8 bytes -1.79769313486231E+308 to 4.94065645841247E-324 for negative
values; 4.94065645841247E-324 to 1.79769313486231E+308 for positive
Integer System.Int32 4 bytes -2,147,483,648 to 2,147,483,647
Long (long integer) System.Int64 8 bytes -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Object System.Object (class) 4 bytes Any type can be stored in a variable of type Object
Short System.Int16 2 bytes -32,768 to 32,767
Single (single-precision floating-point) System.Single 4 bytes -3.402823E+38 to -1.401298E-45 for negative values;
1.401298E-45 to 3.402823E+38 for positive values
String (variable-length) System.String (class) Depends on implementing platform 0 to approximately 2 billion Unicode characters
User-Defined Type (structure) (inherits from System.ValueType) Sum of the sizes of its members Each member of the structure has a range determined by its data
type and independent of the ranges of the other members