Syntax [ | Private | Public
| Friend ] _
Sub name[([param[, ...]])] _
[Handles var.eventname]
statements
End Sub
Group Declaration
Description User defined subroutine. The subroutine defines a set of statements to be executed when it is called. The values of the calling arglist are assigned to the params. A subroutine does not return a result.
Access If no access is specified then Public is assumed.
Handles The Sub provides an event handler for the WithEvents variable's (var) event (eventname).
See Also Declare, Function, Property, WithEvents.
Example '#Language
"WWB.NET"
Sub IdentityArray(A()) ' A() is an array of numbers
For I = LBound(A) To UBound(A)
A(I) = I
Next I
End Sub
Sub CalcArray(A(), B, C) ' A() is an array of numbers
For I = LBound(A) To UBound(A)
A(I) = A(I)*B+C
Next I
End Sub
Sub ShowArray(A()) ' A() is an array of numbers
For I = LBound(A) To UBound(A)
Debug.Print
"("; I; ")="; A(I)
Next I
End Sub
Sub Main
Dim X(1 To 4)
IdentityArray X() ' X(1)=1, X(2)=2, X(3)=3, X(4)=4
CalcArray X(), 2, 3 ' X(1)=5, X(2)=7,
X(3)=9, X(4)=11
ShowArray X() ' print X(1), X(2), X(3), X(4)
End Sub