DATA TYPES & VARIABLES IN VISUAL BASIC
Presented By: Aman Bhatia
Defination of Data Type: A value stored in a variable is interpreted is known as Data Type from language to language.
Visual Basic variables are of variant data types. The variant data type can store numeric, date/time or string data.
The fundamental data types in Visual Basic including variant are integer, long, single, double, string, currency, byte and boolean.
Visual Basic supports a vast array of data types.
Each data type has limits to the kind of information and the minimum and maximum values it can hold.
NUMERIC DATA TYPE
Data types Range
Byte Store integer values in the range of 0 - 255
Integer Store integer values in the range of (-32,768) - (+ 32,767)
Long Store integer values in the range of (- 2,147,483,468) - (+ 2,147,483,468)
Single Store floating point value in the range of (-3.4x10-38) - (+ 3.4x1038)
Double Store large floating value which exceeding the single data type value
Currency store monetary values. It supports 4 digits to the right of decimal point and 15 digits to the left
STRING DATA TYPE
String Data Type use to store alphanumeric values. A variable length string can store approximately 4 billion characters
DATE DATA TYPE
Use to store date and time values. A variable declared as date type can store both date and time values and it can store date values 01/01/0100 up to 12/31/9999
BOOLEAN DATA TYPE
Boolean data types hold either a true or false value. These are not stored as numeric values and cannot be used as such. Values are internally stored as -1 (True) and 0 (False) and any non-zero value is considered as true.
VARIANT DATA TYPE
Stores any type of data and is the default Visual Basic data type. In Visual Basic if we declare a variable without any data type by default the data type is assigned as default
Defination of Variable: Variables are the memory locations which are used to store values temporarily.
A variable name must begin with an alphabet letter and should not exceed 255 characters.
It should not contain any special character like %, &, !, #, @ or $.