Thursday 23 August 2012

VB Programming Basic Concepts - Declaring Variables


VB Programming Basic Concepts -  Declaring Variables

 There are mainly two types in VB:

 1. Object Data Type :

These variables are declared as objects. These can be assigned a value through the Set statement.
Ex : Dim varName As Type

If the type is declared as String then only string value can be assigned to it else it will throw a compile time error.
Type may be any VB object like Integer, Long, String, Date, Double, Currency, Boolean, Byte etc.

2. Variant Data Type :

These are the variables whose data types can be changed easily by assigning different values.
Ex : Dim varName
                 
varName=“IA2Tech”       // Here varName is a string
varName=111            // Here varName is an integer

No comments:

Post a Comment