Property Definition
Syntax:
[ | Private | Public | Friend ] [ Default ] Property Getname[type][([param[, ...]])] [As type[()]]
statements
End Property
-or-
[ | Private | Public | Friend ] Property [Let|Set] name[([param[, ...]])]
statements
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 Get and changing its value calls Property Let (or Property Set). Property Get and Property Let with the same name define a property that holds a value. Property Get and Property Set with the same name define a property that holds an object reference. The values of the calling arglist are assigned to the params. (For Property Let and Property Set the last parameter is the value on the right hand side of the assignment operator.)
Property defaults to Public if Private, Public or Friend are not is specified.
Example:
Dim X_Value
Property Get X()
X = X_Value
End Property
Property Let X(NewValue)
If Not IsNull(NewValue) Then X_Value = NewValue
End Property
Sub Main
X = "Hello"
Debug.Print X
X = Null
Debug.Print X
EndSub