Property Definition

Syntax                  [ | Private | Public | Friend ] _
[ Default ] [ | ReadOnly | WriteOnly ] _
Property name[type][([param])] [As type[()]]
    [Get
        statements
    EndGet]
    [Set(param)
        statements
    EndSet]
End Property

Group                   Declaration

Description           User defined property. The property defines a set of statements to be executed when its value is used or changed. A property acts like a variable, except that getting its value calls Property's Get block and changing its value calls Property's Set block. The values of the calling arglist are assigned to the params. 

•   At a minimum, either a Get or Set block must be specified.

•   If only the Get block is specified the property must be marked as ReadOnly.

•   If only the Set block is specified the property must be marked as WriteOnly.

•   If both the Get and Set blocks are specified the property must not be marked as ReadOnly or WriteOnly.

•   The Set block's parameter type must match the Property's return type.

Access                  If no access is specified then Public is assumed.

See Also               Function, Sub.

Example               '#Language "WWB.NET"
Dim X_Value As String

Property X() As String
    Get
        X = X_Value
    EndGet
    Set(ByVal Value As String)
        X_Value = Value
    EndSet
End Property

SubMain
    X = "Hello"
    Debug.Print X '"Hello"
EndSub