Darkchild
06-09-2007, 10:29 PM
Darkchild's Visual Basic tutorial lesson 1
----------------------------------------------------------------------------------------------------------------------
First thing in programming is...you have to know variables!
Q: What are variables? Simple!
For example...Have you ever used letters in math (like X or Y)? X and Y are variables, they can hold ANY number, but it is you or the program who have to give them the number to hold...Sub Question : Where is this data stored in?
Simple! It's stored in your Ram!
Now, there are lots and lots of types of variables, but for now, I'm gonna teach you the simpler ones that you will need:
Integer
String
Boolean
ByteNow what is the difference between these variables? Simple!
Integer uses whole numbers (you can't use 0.01 as an integer value)
String uses Numbers, letters, special characters like (@£§€)
Boolean uses only two values, true and false
Byte uses numbers from 0 to 255Simple? Good!:biggrin:
Now how to declare these variables (because, they aren't made by themselves!)
Dim name_of_variable as type
Where "name_of_variable" is the name of the variable you are declaringSub Question : Can I put ANY characters in my variables?
Not all... for example you CANNOT use:
Numbers at the beginning of the variable's name
Special Characters
Names of variables that were already declaredat the beginning of the variable's name or else you will have a huge error!
Where Type, you write ONE those 4 types of variables that I told you about.
You can have pretty much as many variables you want, and any amount of variables of the same type you want.
Now How to declare various variables without having to write "DIM" in another line
Dim var1, var2, var3 as integer
I think this is self explanatory XD
More lessons later! Post your questions here if you have any!
You can download Visual Basic here (http://msdn.microsoft.com/vstudio/express/) (although it is .NET, the basics would be...the same).
----------------------------------------------------------------------------------------------------------------------
First thing in programming is...you have to know variables!
Q: What are variables? Simple!
For example...Have you ever used letters in math (like X or Y)? X and Y are variables, they can hold ANY number, but it is you or the program who have to give them the number to hold...Sub Question : Where is this data stored in?
Simple! It's stored in your Ram!
Now, there are lots and lots of types of variables, but for now, I'm gonna teach you the simpler ones that you will need:
Integer
String
Boolean
ByteNow what is the difference between these variables? Simple!
Integer uses whole numbers (you can't use 0.01 as an integer value)
String uses Numbers, letters, special characters like (@£§€)
Boolean uses only two values, true and false
Byte uses numbers from 0 to 255Simple? Good!:biggrin:
Now how to declare these variables (because, they aren't made by themselves!)
Dim name_of_variable as type
Where "name_of_variable" is the name of the variable you are declaringSub Question : Can I put ANY characters in my variables?
Not all... for example you CANNOT use:
Numbers at the beginning of the variable's name
Special Characters
Names of variables that were already declaredat the beginning of the variable's name or else you will have a huge error!
Where Type, you write ONE those 4 types of variables that I told you about.
You can have pretty much as many variables you want, and any amount of variables of the same type you want.
Now How to declare various variables without having to write "DIM" in another line
Dim var1, var2, var3 as integer
I think this is self explanatory XD
More lessons later! Post your questions here if you have any!
You can download Visual Basic here (http://msdn.microsoft.com/vstudio/express/) (although it is .NET, the basics would be...the same).