Professional Documents
Culture Documents
Dynamic Arrays
Using either Public, Dim, Static
First declare the array declaration
Dim TempArr()
Then using Redim statement
Redim TempArr(X+1)
Control Structures
Decision Structures
Visual basic Procedures can test conditions
and then, depending on the results of that
test, perform different operations.
If .. Then
If .. Then .. Else
Select Case
Control Structures
If .. Then Structure
If condition Then
Statements
endif
Control Structures
If .. Then .. Else Structure
If condition Then
[Statementblock-1]
[ElseIf condition2 Then
[statement-2]]
[Else
[Statemnt-n]]
Endif
Control Structures
Select Case statement
Select Case testexpression
[Case expressionlist1
[statemntblock-1]]
[Case expressionlist2
[statement-2]]
..
Case else
[statementblock-n]]
end select
Control Structures
Loop Structure
Loop structure allow you to execute one or
more lines of code repetitively
Do .. Loop
For .. Next
For Each.. Next
Control Structures
Do .. Loop
Test First Condition
Do
Statements
Loop [While/Until] condition
Control Structures
For EachNext
It repeats a group of statements for each element in a
collection of objects or in an array instead of
repeating the statement a specified number of
times
For Each elemen In Group
statements
Next [element]
Scoping Variables
Exit For
Exit Do
Exit Sub
String Functions
String Functions
Len(a) :Returns the length of a string
Mid(a1,Start,length) :returns a specified
number of characters(length), from a string a1,
starting position of Start.
Instr(Start,a1,a2) :Returns the first occurrences
of one string(a2), within another string(a1),
starting(Start) position of a2
String Functions