18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />

Procedure Statements<br />

There are two types of procedure statements; the Sub procedure and the Function procedure. Both of<br />

these procedure statements are intended to encapsulate a set of statements that provide functionality<br />

that can be repeatedly called, but the difference between the two is how arguments are passed and<br />

results returned.<br />

The Sub procedure is a series of <strong>VBScript</strong> statements (enclosed by Sub and End Sub statements) that<br />

per<strong>for</strong>m actions but don't return a value as part of the Sub name. A Sub procedure can take arguments<br />

(constants, variables, or expressions that are passed by a calling procedure). A resultant value or set of<br />

values can be returned through the arguments. If a Sub procedure has no arguments, its Sub<br />

statement must include an empty set of parentheses ().<br />

The Function procedure is a series of <strong>VBScript</strong> statements enclosed by the Function and End<br />

Function statements. A Function procedure is similar to a Sub procedure, but can also return a value<br />

in the Function name. A Function procedure can take arguments (constants, variables, or expressions<br />

that are passed to it by a calling procedure). If a Function procedure has no arguments, its Function<br />

statement must include an empty set of parentheses. A Function returns a value by assigning a value<br />

to its name in one or more statements of the procedure. The return type of a Function is always a<br />

Variant.<br />

Procedure Statements<br />

Function Description<br />

Call Transfers control to a Sub or Function procedure<br />

End Function Immediately exits a Function procedure<br />

End Sub Immediately exits a Sub procedure<br />

Exit Function Exit a Function, generally as a result of a condition<br />

Exit Sub Exit a Subroutine, generally as a result of a condition<br />

Function Declares the name, arguments, and code that <strong>for</strong>m the body of a Function procedure<br />

GetRef Associates an event handler with a specific function<br />

Sub Declares the name, arguments, and code that <strong>for</strong>m the body of a Sub procedure<br />

(Subroutine).<br />

20 <strong>InduSoft</strong>, Ltd.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!