Make your own free website on Tripod.com
Write Your First Visual Basic Program

Lesson 2
Tutorials - Page 1 - Page 2 - Page 3 - Page 4 - Page 5 - Page 6 - Page 7 - Page 8 - Page 9 - Page 10 - Page 11 - Page 12 - Page 13

Choosing A Valid Name For Variable
When declaring on variable, you choose its name.
For example:

Dim Tuti As Integer

The example above will set the variable
name to be "Tuti".
The names you choose for your variables don't have
to have any meaning, but still there are some limitations
about the names you can call your variables.

The Rules:

1)The only characters that can appear in the name are
   letters, numbers and the character _ (the underscore character)
   You can't use other characters like: ` ! @ # % ^ & * ( )
   Therefore, the following names are NOT valid: AB!, BB$, tot#o

2)The Name Must begin with a letter: You can't
    use the names: 2abc, 3, 2345, _aba

3)You can't use space in the variable's name.
   Therefore, the following names are NOT valid: A B, hello world

4)You can't call your variable with a name that is a Visual Basic
   Command or Function (these names are been called "saved names").
   For example you can't use the name Print, because there is
   command in Visual Basic that called Print (which we used pretty much
   in this tutorial).
   You can know easily if a name is a saved name by typing it anywhere
   in your code. All the saved names are being painted with blue color.
   Few examples for saved names: Print, Sub, End, MsgBox

Examples for valid names:
a, A, AaAaA, aBhguKJhUJYf, abc123, abc123abc123, hello_world123


There is much more to learn about variables, like constants,
booleans, arrays and more.
What you've learnt by now is necessary for continuing
with the next lessons.
More advanced variables subjects will appear
during the next lessons.

Go to Lesson 3 to learn more about Events and properties

Back  Forward