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

Set<br />

Description Assigns an object reference to a variable or property, or associates a procedure reference with an<br />

event.<br />

Usage Set objectvar = {objectexpression | New classname | Nothing}<br />

or<br />

Set object.eventname = GetRef(procname)<br />

Arguments objectvar<br />

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

objectexpression<br />

Optional expression consisting of the name of an object, another declared variable of the<br />

same object type, or a function or method that returns an object of the same object type.<br />

New<br />

Keyword used to create a new instance of a class. If objectvar contained a reference to an<br />

object, that reference is released when the new one is assigned. The New keyword can only<br />

be used to create an instance of a class.<br />

classname<br />

Optional. Name of the class being created. A class and its members are defined using the<br />

Class statement.<br />

Nothing<br />

Optional. Discontinues association of objectvar with any specific object or class. Assigning<br />

objectvar to Nothing releases all the system and memory resources associated with the<br />

previously referenced object when no other variable refers to it.<br />

object<br />

Required. Name of the object with which event is associated.<br />

event<br />

Required. Name of the event to which the function is to be bound.<br />

procname<br />

Required. String containing the name of the Sub or Function being associated with the event.<br />

Remarks To be valid, objectvar must be an object type consistent with the object being assigned to it. The<br />

Dim, Private, Public, or ReDim statements only declare a variable that refers to an object. No<br />

actual object is referred to until you use the Set statement to assign a specific object.<br />

Generally, when you use Set to assign an object reference to a variable, no copy of the object is<br />

created <strong>for</strong> that variable. Instead, a reference to the object is created. More than one object<br />

variable can refer to the same object. Because these variables are references to (rather than<br />

copies of) the object, any change in the object is reflected in all variables that refer to it. Using the<br />

New keyword allows you to concurrently create an instance of a class and assign it to an object<br />

reference variable. The variable to which the instance of the class is being assigned must already<br />

have been declared with the Dim (or equivalent) statement.<br />

Refer to the GetRef function <strong>for</strong> in<strong>for</strong>mation on using Set to associate a procedure with an event.<br />

See Also GetRef<br />

Example Set fso = CreateObject("Scripting.FileSystemObject")<br />

Set d = fso.GetDrive(fso.GetDriveName(drvPath))<br />

Set db = CreateObject(ADODB.Connection’)<br />

Stop<br />

Description Suspends execution<br />

Usage Stop<br />

Arguments None<br />

Remarks You can place Stop statements anywhere in procedures to suspend execution. Using the Stop<br />

statement is similar to setting a breakpoint in the code. The Stop statement suspends execution,<br />

but it does not close any files or clear any variables. The Stop statement has no effect unless the<br />

script is being debugged. This function does not work in IWS.<br />

See Also Debug object<br />

Example For i = 1 to 5<br />

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

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

Saved successfully!

Ooh no, something went wrong!