Occurs when all references to an instance of a form object are removed from memory by setting all the variables that refer to the form object to Nothing or when the last reference to the form object falls out of scope.
Object.OnTerminate()
The OnTerminate event syntax has the following parts:
Name |
Type |
Description |
Object |
AForm |
AForm object |
The OnTerminate event occurs after the OnUnload event. It is called after the form window, controls and menus are destroyed.
The event does not occurs as a result of a UnLoad statement.
The OnTerminate event is not triggered if the instances of the form or class were removed from memory because the application terminated abnormally. For example, if your application invokes the Exit statement before removing all existing instances of the class or form from memory, the OnTerminate event is not triggered for that class or form.