Saturday 8 September 2012

VB 6.0 Datatypes


Declaring Variables
Declaring variable is letting VB know about how we intend to use the variable. For example, if you declare a variable as String, then it means you want to store characters into it. Dim statement is used to declare variables.

Dim variable [as datatype]

Variable is the name of the variable and datatype is the type of variable. If datatype is not given then variable is taken to be of variant type. 
 
Examples

Dim  n as integer
Dim amount as long, discount as integer
Dim amount, totamount  as long

In the last example, only totamount is taken to be long and amount is treated as variant type.


No comments:

Post a Comment