11.07.2015 Views

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

VBScript Reference Manual for InduSoft Web Studio - ICP DAS

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong>Class Object variables are accessible to <strong>VBScript</strong> code outside the Class through Class Properties.Class Properties “wrap” the Private variables of a Class. Inside the Class block, the Properties aredefined by Property Get [|Let|Set] … End Property statement(s). For <strong>VBScript</strong> code outside theClass, the Property is accessed by referencing the Object Name.Property.There are different type of Class Properties, depending on whether the Class variable is to be read,written to, or the Class variable is itself a Class Object. These Properties can be declared Public orPrivate.Property GetThe Property Get procedure is used to access (return) private variables inside of the Classstructure that are used as a read-only Property, or the read portion of a read-write Property. For<strong>VBScript</strong> code outside the Class, this type of Class Object Property is generally assigned to avariable or used in a conditional expression. The Property Get procedure returns a value to thecalling code, and is general not used with any arguments. [Note: <strong>VBScript</strong> will let you addarguments to the Property Get procedure, but if you do so you must add the additionalargument to the corresponding Property Let or Property Set procedure, since PropertyLet/Property Set must have one more argument than the corresponding Property Getprocedure. It is generally considered bad programming <strong>for</strong>m to have arguments in the PropertyGet procedure].Property LetThe Property Let procedure is used to access (assign) private variables inside of the Classstructure that are used as a write-only Property or are the write portion of a read-write Property.For <strong>VBScript</strong> code outside of the Class, this type of Class Object Property is usually assignedby a variable or a constant.Property SetThe Property Set procedure is exclusively used when the Class Object needs to storeProperties that are object-based instead of numeric, date, boolean or string subtype variables.Property Set replaces the Property Let procedure. While Property Set and Property Let arefunctionally similar, there are two key differences:1. With the Property Set procedure, in the <strong>VBScript</strong> code segment (outside the Class block)you must use the syntaxSet Object1.Property = Object2This is because <strong>VBScript</strong> does not let you use the assignment operator (=) to assign objectswithout the Set command.2. The Property Set procedure makes it clear that the Property is an object-based PropertyExample:Class FileSpec‘ Define a Class blockPrivate master_filePrivate master_FSOPublic Property Let FileName(strName) ‘ Define a Public Property to assign the file namemaster_file = strNameEnd PropertyPublic Property Get FileName ‘ Define a Public Property to retrieve a file nameFileName = master_fileEnd PropertyPublic Property Set FSO(m_FSO)‘ Define a Public Property <strong>for</strong> an objectSet master_FSO = m_FSO<strong>InduSoft</strong>, Ltd. 25

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

Saved successfully!

Ooh no, something went wrong!