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 />

<strong>VBScript</strong> Objects and Collections<br />

Objects and collections<br />

Class Object Matches Collection<br />

Debug Object RegExp Object<br />

Err Object SubMatches Collection<br />

Match Object<br />

These Objects and Collections are “built-in” to <strong>VBScript</strong> and do not rely on any runtime libraries or<br />

ActiveX components.<br />

Class<br />

Description Declares the name of a class, as well as a definition of the variables, properties, and methods<br />

that comprise the class<br />

Usage Class classname<br />

statements<br />

End Class<br />

Arguments classname<br />

Required. Name of the Class; follows standard variable naming conventions.<br />

statements<br />

Required. One or more statements that define the variables, properties, and methods of the<br />

Class.<br />

Remarks Within a Class block, members are declared as either Private or Public using the appropriate<br />

declaration statements. Anything declared as Private is visible only within the Class block.<br />

Anything declared as Public is visible within the Class block, as well as by code outside the<br />

Class block. Anything not explicitly declared as either Private or Public is Public by default.<br />

Procedures (either Sub or Function) declared Public within the class block become methods of<br />

the class. Public variables serve as properties of the class, as do properties explicitly declared<br />

using Property Get, Property Let, and Property Set. Default properties and methods <strong>for</strong> the<br />

class are specified in their declarations using the Default keyword. See the individual declaration<br />

statement topics <strong>for</strong> in<strong>for</strong>mation on how this keyword is used. You must instantiate an object to<br />

use it, using the Set command; i.e. Set objname = New classname.<br />

The Class block also supports two special subroutines; Class_Initialize() and<br />

Class_Terminate(). Code in the Class_Initialize() subroutine executes one time when the Class<br />

is instantiated by the statement Set objName = New classname. Code in the Class_Terminate()<br />

subroutine executes once when the Class is terminated by the Set objName = Nothing statement<br />

or when the Class goes out of scope. The Class_Initialize() and Class_Terminate() subroutines<br />

can be Private or Public, but it is recommended to make these Private so that these subroutines<br />

may not be called by another code segment.<br />

See Also Property Get, Property Let, Property Set<br />

Example Class SignOn<br />

Private MyName, MyLevel ‘Variable declaration<br />

Private Sub Class_Initialize()<br />

‘Rem Code here executes when Set objName = Class classname statement is executed<br />

End Sub<br />

Private Sub Class_Terminate()<br />

‘Rem Code here executes when Set objName = Nothing statement is executed or<br />

‘code goes out of scope.<br />

End Sub<br />

Public Property Let UsrName(strName) ‘Set the property value <strong>for</strong> user name<br />

MyName = strName<br />

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

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

Saved successfully!

Ooh no, something went wrong!