Unload Forms

Unload Forms

This will unload all forms in memory before the calling form is unloaded. Not only does this unload each form, it also fires each form’s unload event, allowing for a more thorough clean up. Since this is placed in the Query_Unload event, errors can be handled and decisions can be made if the unloading should continue. This is especially useful when using other third-party controls such as the splitter control.
Place the following code in your main form’s Query_Unload event.

 Dim f As FormFor Each f In Forms    If f.hwnd  Me.hwnd Then        Unload f    End IfNext



Share the Post: