Executing code when setting properties
You can create Property Let, Property Set, and Property Get procedures that share the same name. By doing this, you can create a group of related procedures that work together. Once a name is used for a Property procedure, that name can't be used to name a Sub or Function procedure, a variable, or a user-defined type.
The Property Let statement allows you to create a procedure that sets the value of the property. One example might be a Property procedure that creates an inverted property for a bitmap on a form. This is the syntax used to call the Property Let procedure:
|
The actual work of inverting a bitmap on the form is done within the Property Let procedure:
|
The form-level variable
|
This Property Get procedure is used to return the current state of the
|
|
Property procedures make it easy to execute code at the same time the value of a property is set. You can use property procedures to do the following processing:
- Before a property value is set to determine the value of the property.
- After a property value is set, based on the new value.