PRB: Object that Received the Destroy Not Released

Last reviewed: April 30, 1996
Article ID: Q127844
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SYMPTOMS

Calling the Destroy() function under program control to release an object does not work. The object is still there and its methods can perform tasks. This behavior is particularly visible with a form that receives the Destroy() because the form window is not deactivated.

CAUSE

When Destroy() is explicitly called under program control, the method associated with the event is executed. However, calling the method does not trigger the event. To release a form, you must release the instance variable referencing the form object. The variable is released when it goes out of scope or when the RELEASE command is issued.

STATUS

This behavior is by design.

MORE INFORMATION

In the Visual FoxPro event model, calling a method associated with an event will not trigger the event. The method can be executed as a response to an event or as a response to an explicit call (such as Thisform.Click()). To trigger the CLICK, DBLCLICK, MOUSEDOWN, MOUSEMOVE, or MOUSEUP events, use the MOUSE command. The ERROR event can be triggered by the ERROR command. For a list of events that Microsoft Visual FoxPro objects respond to, search for Events under the Language Reference topic in Visual FoxPro Help.


Additional reference words: 3.00 VFoxWin
KBCategory: kbprg kbprb
KBSubcategory: FxprgClassoop


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.