VBScript Reference Manual for InduSoft Web Studio
VBScript Reference Manual for InduSoft Web Studio
VBScript Reference Manual for InduSoft Web Studio
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong> <strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong><br />
Class Object variables are accessible to <strong>VBScript</strong> code outside the Class through Class Properties.<br />
Class Properties “wrap” the Private variables of a Class. Inside the Class block, the Properties are<br />
defined by Property Get [|Let|Set] … End Property statement(s). For <strong>VBScript</strong> code outside the<br />
Class, the Property is accessed by referencing the Object Name.Property.<br />
There are different type of Class Properties, depending on whether the Class variable is to be read,<br />
written to, or the Class variable is itself a Class Object. These Properties can be declared Public or<br />
Private.<br />
Property Get<br />
The Property Get procedure is used to access (return) private variables inside of the Class<br />
structure that are used as a read-only Property, or the read portion of a read-write Property. For<br />
<strong>VBScript</strong> code outside the Class, this type of Class Object Property is generally assigned to a<br />
variable or used in a conditional expression. The Property Get procedure returns a value to the<br />
calling code, and is general not used with any arguments. [Note: <strong>VBScript</strong> will let you add<br />
arguments to the Property Get procedure, but if you do so you must add the additional<br />
argument to the corresponding Property Let or Property Set procedure, since Property<br />
Let/Property Set must have one more argument than the corresponding Property Get<br />
procedure. It is generally considered bad programming <strong>for</strong>m to have arguments in the Property<br />
Get procedure].<br />
Property Let<br />
The Property Let procedure is used to access (assign) private variables inside of the Class<br />
structure that are used as a write-only Property or are the write portion of a read-write Property.<br />
For <strong>VBScript</strong> code outside of the Class, this type of Class Object Property is usually assigned<br />
by a variable or a constant.<br />
Property Set<br />
The Property Set procedure is exclusively used when the Class Object needs to store<br />
Properties that are object-based instead of numeric, date, boolean or string subtype variables.<br />
Property Set replaces the Property Let procedure. While Property Set and Property Let are<br />
functionally similar, there are two key differences:<br />
1. With the Property Set procedure, in the <strong>VBScript</strong> code segment (outside the Class block)<br />
you must use the syntax<br />
Set Object1.Property = Object2<br />
This is because <strong>VBScript</strong> does not let you use the assignment operator (=) to assign objects<br />
without the Set command.<br />
2. The Property Set procedure makes it clear that the Property is an object-based Property<br />
Example:<br />
Class FileSpec ‘ Define a Class block<br />
Private master_file<br />
Private master_FSO<br />
Public Property Let FileName(strName) ‘ Define a Public Property to assign the file name<br />
master_file = strName<br />
End Property<br />
Public Property Get FileName ‘ Define a Public Property to retrieve a file name<br />
FileName = master_file<br />
End Property<br />
Public Property Set FSO(m_FSO) ‘ Define a Public Property <strong>for</strong> an object<br />
Set master_FSO = m_FSO<br />
<strong>InduSoft</strong>, Ltd. 25