I've read the other 3 posts. Two of them are accurate and another is
totally wrong. Never use the End statement. What Shane said is accurate.
For some reason or another one of your forms are not being unloaded
properly. This can be due to a number of reasons. To help make sure each
form is unloaded also add the line:
Set <form name> = Nothing
in each forms Unload event. This will for all form level variable and
objects to be cleared and return that memory back to windows.
Also, what Doug said is correct. But there are other ways w/o any coding.
First, if it is a mdi application the mdi form should be the main
application. Then every child form will automatically be unloaded when the
mdi form is unloaded. Of course this will only work w/o code if all the
forms are children forms. You will need to incorporate Dougs suggestion
into your app. Another way is strictly only if you are using VB5. The show
method has another parameter, ownerform (i.e. form.show <state>,
<ownerform>). If your app is a non mdi app then you can mimick the mdi
form/child form behavior by using a form name in the ownerform parameter.
That way, when you mimimize or restore that form (used in the parameter),
any forms shown with that as the owner form will mimimize/restore also. The
same goes for unloading. If you unload the ownerform, the other forms will
unload.
After all this though, one thing still stands, put the Set <form> = Nothing
in all form/mdi form Unload events.
Now, if this doesn't cure the problem, make sure you are not referencing any
controls or variables of another form after unloading it. This happens
sometimes.
Tony Fountain
Digital Horizons, Inc.
Senior Application Developer
remove NOSPAM. to respond directly.
Quote:
>I have a program which frequently switches from form to form using
>'unload form1'
>'form2.show'
>This works properly, however, when I try to close a form (the application)
>using the close 'x' button on the right hand corner of the title bar it
>closes that form but does not close the application. How do I unload the
>enire application??