Friday, May 6, 2011 Tutorial 2 : The language



The code is very similar to the VB6 language.
For example : making a form is pretty easy :
the instruction "inherits" is to explain that the class we create must inherit from all elements in the class "form".


 When building a new module that code is generated.
All the code contained in the module will be inserted between "Module" and "End Module"


Commentaires are used to add information on the code and will not be executed and removed from the final code.

To add a comment you can use the " ' " character.
example : 'this is a commentarie


Byte :  from 0 to 255

Short : from -32768 to 32767

Integer : from -2 147 483 648 to 2 147 483 647

long : from  -9223372036854775808 to 9223372036854775807


Char : used for 1 character
String : for multiples characters
to declare a variable you just have to type : Dim variablename as type

example : Dim i as integer
Dim myvar as string
Dim today as date


Arrays can be used to store more than one information in one variable.
to declare an array the syntax is :
Dim myarray(10) as integer
to declare an array of 10 integer
to use an element of the array type : myarray(number)

example :

to change the size of an array, use the "redim" keyword

example :

dim foobar(10) as array 'declare an array of 10 elements
redim foobar(15) 'changes the size of the array to 15 elements
redim preserve foobar(20 'changes the size without destroying elements


Constants are usefull to store data wich is not subjet to changes.
example : dim constant = 10


To set a value to a variable, use the "=" operator
example :
dim foo as integer
foo= 4
is equivalent to
dim foo as integer=4

Other operators :

+ : addition

- : subtraction

* : multiplication

/ : division

^ : power

= : equals

<> : not equal

< : inferior

> : superior

<= : inferior or equal

>= : superior or equal

Like : for strings

No comments:

Post a Comment