ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾VBScript£¾VBScript


objects constants operators statements functions properties methods






STATEMENT:  Property Get

Property Get ... Property End

VBScript 5.0

The Property Get statement block allows you to perform a procedure that will return the value of a property.

The Property Get statement block can only be used inside a Class statement block and cannot be used inside of any other procedure. There are two other related statements that also can only be used within a Class block, Property Let and Property Set that, respectively, permit you to assign the value of a property and to set a reference to an object.

The Property Get statement allows you to declare the name of the procedure, to accept and change the values of optional arguments, and to perform a series of statements that ultimately return the value of a property.

By default, the Property Get procedure is Public, but you can declare it to be Private. You can use the optional Exit Property statement to immediately exit the from inside the Property Get procedure, but do not forget to assign the return value before doing such an exit.

Note how the returned value is assigned to the procedure name, "ProcedureName" in the syntax example. It can be assigned from an expression or set to an object.

The Property End is required.

Syntax:

[ Public | Private ] Property Get ProcedureName [arguments, ..., ...]
      Rem You may place code here
      [ ProcedureName = expression | Set ProcedureName = expression ]
      [ Exit Property ]
      Rem You may place code here
      [ ProcedureName = expression | Set ProcedureName = expression ]
Property End