VARIABLES

Variables store values during a program execution. Variables are place holders in which you can leave and recall them. A variable has a name and a value.

For Example: Value=0.35

                         User Name=”joe”.

VARIABLE NAMING CONVENTION

When declearing variables we should be aware of a few naming convention that are

                                            i.            Must being with a leter.

                                        ii.            Must not exceed with 255 characters.

                                    iii.            Must be unique.

TYPES OF VARIABLES

Visual Basic recognizing six types of variables.

1. Numeric.

2. String.

3. Boolean.

4. Date.

5. Object.

6. Variant.

NUMERIC VARIBLES

Numeric Variable includes following numeric data type.

1. Integers.

2. Single floating points.

3. Double floating point.

4. Long.

5. Currency.

DATA TYPE

DISCRIPTION

Integers

 Long

 

 

 Double floating point

Store integers value from -32768 to 32768

Store integers in the ranges of -2147, 483, 648 to 2147, 483. 648.

 

Double floating points numbers can represent both negative and positive number in a large range.

 

STRING VARIABLE

The string data types store only text and string variables are decleared with the string type for example: Dim A-ds string A= “Ayesha”.

BOOLEAN

Boolean data types store True/False values. Visual Basic Allocates two bits to this data type non “O” value is consider True.

For example: Label1.visible=T

DATA VARIABLES

Data and time values are store intermaly in a special formit Visual Basic many objects and you can use an object variable to excess the actual object.

OBJECT VARIABLES

In object variable decleared as variant is handel by Visual Basic according to the variable’s current contexts variant can also hold different data types.

For example: Dim my name As variant.

SPECIAL VALUES

Variables have the values your program assignes to them. Before any value assigens to them, Numeric values are “O” and string variable length. There for we have four special values (Empty, Nothing, Null, Error).

EMPTY VALUE

If a variable is decleared in a program but not been assigens a value, the value is empty.

NOTHING VALUE

The nothing value is used with objects and indicates that an object variable has not been initialized.

NULL VALUE

Null is commonly use in data bases. It indicates that the field does not contain data or value or the data variable has not been a assigen the value for the null value.

ERROR VALUE

It allows you two describe a function that returns an error if it accurs in a program.

CONSTANTS

Some variables not change values during the execution of a program. These are the constants that appears many time in the code.

 For example: Pi=3.1412….

If we have to calculate different parameters then we have to define a constant of Pi, for using it many time the code.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s