Specialized subs

LotusScript® recognizes four specialized kinds of user-defined subs to automate set-up and clean-up in an application.

Sub Initialize

Sub Initialize lets you perform set-up operations on loading a module. LotusScript® automatically executes a Sub Initialize when the application loads the module in which you defined it, performing the operations specified in the sub. You can define only one Sub Initialize per module. The syntax is:

Sub Initialize

statements

End Sub

Sub Initialize is Private in scope. Its signature can't include a parameter list; LotusScript® has no way of passing arguments to a Sub Initialize when it calls it. A Sub Initialize is not subject to the usual restrictions concerning the sorts of statements and directives that a user-defined procedure can contain.

Note: Not all implementations of LotusScript® support a user-defined Sub Initialize.

Sub Terminate

Sub Terminate lets you perform clean-up operations when the application unloads a module. As with Sub Initialize, LotusScript® automatically executes a Sub Terminate when the application unloads the module in which it is defined, performing the operations specified in the sub. You can define only one Sub Terminate per module. The syntax for Sub Terminate is:

Sub Terminate

statements

End Sub

Sub Terminate is Private in scope. Its signature can't include a parameter list, and it is not subject to the usual restrictions concerning the sorts of statements and directives that a user-defined procedure can contain.

Sub New and Sub Delete

Sub New and Sub Delete are special features of user-defined classes.

For more information on these subs, see "User-defined Data Types and Classes."