Visual Basic Fundamentals-I
Visual Basic Fundamentals-I
Tahir Mahmood
1
Outline
2
Introduction to VB
3
Variables
A variable is an area of computer memory
you use in your program.
To use a variable, you must give it a name.
There are rules you should, and usually
must, follow when naming your variables.
4
Variable naming conventions
Must begin with a letter.
Cannot have a period (remember that we use the period
to set a property; in other words the period is an
operator)
Can have up to 255 characters. Please, just because it is
allowed, don't use 255 characters.
Must be unique inside of the procedure or the module it
is used in (we will learn what a module is)
Once a variable has a name, you can use it as you see
fit. For example, you can assign it a value and then use
the variable in your program as if it represented that
value.
5
Before declaring or using a variable, first decide what
kind of role that variable will play in your program.
Different variables are meant for different situations. The
kind of variable you want to use is referred to as a data
type. To specify the kind of variable you want to use, you
type the As keyword on the right side of the variable's
name. The formula to declare such a variable is: