Removes a property from an object at run time.
- Specifies the name of the object from which to remove the property.
- Specifies the name of the existing property to remove from the object. You can specify only a property name, not an event or method name.
Logical data type. REMOVEPROPERTY( ) returns True (.T.) if it successfully removes the property; otherwise, it returns False (.F.).
You can use REMOVEPROPERTY( ) to remove properties, but not methods or events. You can use REMOVEPROPERTY( ) with object instances created from Visual FoxPro classes, COM classes, SCATTER...NAME command, _VFP, and _SCREEN.
Properties must be visibly Public, not Hidden or Protected and have been added to an instance of an object, typically using the ADDPROPERTY(В ) function, the AddProperty method, or SCATTER...NAME command, so that they can be removed using REMOVEPROPERTY( ).
You cannot remove a property if it is a member of the class definition used to create the instance of the object.
REMOVEPROPERTY(В ) function does not remove properties that are specific array elements. To remove an array, provide only the array name.
The following example adds a new property to an object created with the SCATTER command and then removes it.
USE customers SCATTER NAME oCust ADDPROPERTY(oCust,"MyProperty") REMOVEPROPERTY(oCust,"MyProperty")
The following example creates a property array for the object,
oMyForm, displays its contents,
"Two", and then removes it.
oMyForm = CREATEOBJECT('Form') ADDPROPERTY(oMyForm, 'MyArray(2)', 1) oMyForm.MyArray(2) = "Two" CLEAR ? oMyForm.MyArray(1) ? oMyForm.MyArray(2) REMOVEPROPERTY(oMyForm, 'MyArray') RELEASE oMyForm CLEAR