UnloadForm Method
Object List Next Object
Defined By: Form
Description:
Occurs right before a form is closed, thus removing it from the screen. This
event can be caused by various user actions or by using an Unload statement in
code.
Declaration:
Sub UnloadForm( )
Details:
Use the Unload event to specify what should occur when a form is unloaded.
Unload events are commonly used to:
Reset the contents of the controls on a form before removing it from memory.
Note: All controls on a form are automatically reinitialized when the form is
reloaded.
Force a user to verify that it is OK to close the form.
Display a message warning a user to save or to enter vital information before
closing. (The save procedure or validation code can be included in the Unload
event.)
To prevent a form from being removed without preventing other events, set
Cancel to a nonzero value.
All forms are automatically closed when the program is ended, such as when
Windows is exited while the application is still running. Hiding a form does not
cause an Unload event.
See Also:
Load event, Unload event