VB.Net Data Types II
Integer data type
} The Integer data type widens to Long, Decimal, Single, or Double
} The default value of Integer is 0.
Eg:-
' The valid range of an Integer variable is -2147483648
through +2147483647.
Dim k As Integer
' The following statement causes an error because the value is too large.
k = 2147483648
' The following statement sets k to 6.
k = CInt(5.9)
Long Data Type
} 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.
Short Data Type
} Use the Short data type to contain integer values that do not require the full data width of Integer. In some cases, the common language runtime can pack your Short variables closely together and save memory consumption.
} Holds signed 16-bit (2-byte) integers that range in value from -32,768 through 32,767.
} The default value of Short is 0.
} Eg:-
Dim Value As Short = 32700
String data type
} Use the String data type to hold multiple characters
} The default value of String is Nothing (a null reference). Note that this is not the same as the empty string (value "").
} Eg:-
Dim j As String = "Joe said ""Hello"" to me." Dim h As String = "Hello"
Char data type
} Use the Char data type when you need to hold only a single character and do not need the overhead of String. In some cases you can use Char(), an array of Char elements, to hold multiple characters.
} The default value of Char is the character with a code point of 0.
} Eg:-
Option Strict On Dim charVar As Char
‘ The following statement attempts to convert a
‘ String literal to Char.
‘ Because Option Strict is On, it generates a
‘ compiler error.
charVar = "Z"
' The following statement succeeds because it ‘specifies a Char literal.
charVar = "Z"C
Option Strict Statement
} Restricts implicit data type conversions to only widening conversions.
Option Strict { On | Off }
} On Optional. Enables Option Strict checking.
} Off Optional. Disables Option Strict checking. If On or Off is not specified, the default is Off.
} Option Strict statement must appear in a file before any other source code statements
} Visual Basic allows conversions of many data types to other data types.
} Data loss can occur when the value of one data type is converted to a data type with less precision or smaller capacity.
} A run-time error occurs if such a narrowing conversion fails.
} Option Strict ensures compile-time notification of these narrowing conversions so that they can be avoided.
Boolean Data type
} Holds values that can be only True or False.
} The keywords True and False correspond to the two states of Boolean variables.
Eg:-
Such a helpful information.
This really helped me a lot!
Thanks both of u.. :D