Classes archives - The VBScript Network and Systems Administrator's Cafe

The VBScript Network and Systems Administrator's Cafe:

Classes

Sep 27 2008   8:19PM GMT

VBScript Statements: Explanation of the Private Statement



Posted by: Jerry Lees
VBScript Statements, Classes, Private

The Private statement is used to declare a variable as being Private inside a script. If used outside of a class it has little effect and the variable can be used throughout the script, however, if used inside a class statement it will only be able to be used inside the class statement itself.

The use of this statement works exactly like using Dim, except that the initialization of the variable must happen on a second line of code. Below is an example:

Private PrvVariable
PrvVariable = 10

Sep 18 2008   7:31PM GMT

VBScript Statements: Explanation of the Property Let Statement



Posted by: Jerry Lees
VBScript, VBScript Statements, Classes, Property, Property Let

Within a VBScript class the Property block allows you to set the name of the property in the class. This statement works in conjunction with the Property Set and Property Get statements and can only be used inside a class inside VBScript– and no where else in the script.

 By default the Property Let statement is public but you can declare it to be private if you need to do so. Since this statement is used in a block, it is required that you end the block with the End Property statement. The block of code will look something like this:

Property Let PropertyName

 ’ code goes here

End Property