Release, AutoRelease

The Release method lets you get rid of forms and form sets in an OOP way without needing to know the name of the variable that references the thing. AutoRelease determines whether a form set gets released when all its forms are gone.

Usage

oObject.Release()
frsFormSet.AutoRelease = lLetItGo
lLetItGo = frsFormSet.AutoRelease
Release exists because you need a way to shut down a form (or form set) when the user presses the OK (or Cancel or Close or whatever) button. Just put ThisForm.Release() in the Click method and you're set. This method of shutting down a form does not fire the form's QueryUnload method, so you may want to call QueryUnload explicitly and issue Release only if QueryUnload returns .T.It's possible to close all the forms in a form set and still have the form set object hanging around in memory. AutoRelease lets you change that. If you set it to .T., the form set is released as soon as its last form member is gone. However, form sets created in the Form Designer are always released when their last form goes away, regardless of the setting of AutoRelease. Only form sets created as objects (using CreateObject() or NewObject()) can cling to life when they're empty. Take a look at the example for ON SHUTDOWN for one approach to using Release.

Example

* Put this in a Close button's Click method.
ThisForm.Release()

See Also

Destroy, On Shutdown, QueryUnload, ReleaseType, Unload


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .