VB.NET DATA TYPE
- In VB.NET, data type is used to define the type of a variable or function in a program.
- A Data Type refers to which type of data or value is assigning to a variable or function
- Data type are used when declaring variables and constants
Syntax:
Dim Variable_Name as DataType
VariableName: It defines the name of the variable assigned to store values.
DataType: It represents the name of the data type assigned to a variable.
Different Data Types and their allocating spaces in VB.NET
The following table shows the various data types list in the VB.NET programming language.
Data Types Required Space Value Range
A Boolean type depends on
Boolean True or False
the implementing platform
Byte 1 byte Byte Range start from 0 to 255 (unsigned)
Char 2 bytes Char Range start from 0 to 65535 (unsigned)
Date range can be 0:00:0 (midnight) January 1, 0001 to
Date 8 bytes
11:5959 PM of December 31, 9999.
Range from 0 to +/-
79,228,162,514,264,337,593,543,950,335
Decimal 16 bytes (+/-7.9…E+28) without any decimal point;
And 0 to +/-7.92281625142264337593543950335 with 28
position to the right of the decimal
, -1.79769313486231570E+308 to -4.94-65645841246544E-
324 for negative values;
Double 8 bytes
4.94065645841246544E-324 to
1.79769313486231570E+308, for positive values
Integer 4 bytes -2,147,483,648 to 2,147,483,647 (signed)
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Long 8 bytes
(9.2…E + 18) (signed)
Object size based on the
platform such as 4 bytes in It can store any type of data defined in a variable of type
Object
32-bit and 8 bytes in 64-bit Object
platform
SByte 1 byte -128 to 127 (signed)
Short 2 bytes -32,768 to 32,767 (signed)
-3.4028235E + 38 to -1.401298E-45 for negative values;
Single 4 bytes
And for positive value: 1.401298E-45 to 3.4028235E + 38.
String Datatype depend on It accepts Unicode character from 0 to approximately 2
String
the implementing platform billion characters.
UInteger 4 bytes The range start from 0 to 4,294,967,295 (unsigned)
The range of ULong start from 0 to
ULong 8 bytes
18,446,744,073,709,551,615 (1.8…E + 19) (unsigned)
User- A user-defined data type
Each member of the structure has its own data type and
Defined depends on the
limits independent of the other members' ranges.
(structure) implementing platform
UShort 2 bytes Range from 0 to 65,535 (unsigned)
Example of Variable declaration statements
Dim b As Byte = 1
Dim num As Integer = 5
Dim si As Single
Dim db As Double
Dim get_date As Date
Dim c As Char
- In VB.NET, data type is used to define the type of a variable or function in a program.
- A Data Type refers to which type of data or value is assigning to a variable or function
- Data type are used when declaring variables and constants
Syntax:
Dim Variable_Name as DataType
VariableName: It defines the name of the variable assigned to store values.
DataType: It represents the name of the data type assigned to a variable.
Different Data Types and their allocating spaces in VB.NET
The following table shows the various data types list in the VB.NET programming language.
Data Types Required Space Value Range
A Boolean type depends on
Boolean True or False
the implementing platform
Byte 1 byte Byte Range start from 0 to 255 (unsigned)
Char 2 bytes Char Range start from 0 to 65535 (unsigned)
Date range can be 0:00:0 (midnight) January 1, 0001 to
Date 8 bytes
11:5959 PM of December 31, 9999.
Range from 0 to +/-
79,228,162,514,264,337,593,543,950,335
Decimal 16 bytes (+/-7.9…E+28) without any decimal point;
And 0 to +/-7.92281625142264337593543950335 with 28
position to the right of the decimal
, -1.79769313486231570E+308 to -4.94-65645841246544E-
324 for negative values;
Double 8 bytes
4.94065645841246544E-324 to
1.79769313486231570E+308, for positive values
Integer 4 bytes -2,147,483,648 to 2,147,483,647 (signed)
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Long 8 bytes
(9.2…E + 18) (signed)
Object size based on the
platform such as 4 bytes in It can store any type of data defined in a variable of type
Object
32-bit and 8 bytes in 64-bit Object
platform
SByte 1 byte -128 to 127 (signed)
Short 2 bytes -32,768 to 32,767 (signed)
-3.4028235E + 38 to -1.401298E-45 for negative values;
Single 4 bytes
And for positive value: 1.401298E-45 to 3.4028235E + 38.
String Datatype depend on It accepts Unicode character from 0 to approximately 2
String
the implementing platform billion characters.
UInteger 4 bytes The range start from 0 to 4,294,967,295 (unsigned)
The range of ULong start from 0 to
ULong 8 bytes
18,446,744,073,709,551,615 (1.8…E + 19) (unsigned)
User- A user-defined data type
Each member of the structure has its own data type and
Defined depends on the
limits independent of the other members' ranges.
(structure) implementing platform
UShort 2 bytes Range from 0 to 65,535 (unsigned)
Example of Variable declaration statements
Dim b As Byte = 1
Dim num As Integer = 5
Dim si As Single
Dim db As Double
Dim get_date As Date
Dim c As Char