Microsoft KB Archive/232093

= BUG: Objects Disappear After Being Assigned to Custom Properties =

Article ID: 232093

Article Last Modified on 10/16/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q232093



SYMPTOMS
If you use the Assign method, when creating an object and the following code is fired three or more times, the object that is being assigned to the property disappears from memory: propertyname = THIS



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
After assigning an object to a property using the THIS reference, the property will then share the same properties, methods, and events as the object. After assigning the THIS reference to the property three or more times, the object is removed from memory and the value of the property returns to a null value. If the Assign method is not used when the property is created, an object can be assigned to the property repeatedly without being removed from memory.

WORKAROUND
By assigning the property back to null before assigning the value of the object to it, the object will not disappear. For example: propertyname = NULL propertyname = THIS

Steps to Reproduce Behavior
 Create a form and add a New property named MyProp to the form. Next, select the Assign method check box.  Add a command button and place the following code in Click event of the command button: ThisForm.MyProp = THIS  Run the form and click the command button numerous times. Note that the command button disappears from the form.

Keywords: kbbug kboop kbcontainer kbctrl kbpending KB232093

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.