August 4th, 2004, 10:13 PM
Unload Form does not always terminate program execution
I've seen several cases where all of the forms in my app are closed, yet dialog boxes still pop up, indicating a problem.
This makes the users feel uneasy :-)
What is the proper way to COMPLETELY terminate execution in a VB app, after all the forms have been unloaded ?
August 4th, 2004, 11:13 PM
Just make sure that after you have unloaded the form there shoud be no code in the program that makes use of the form.
August 4th, 2004, 11:59 PM
I agree with Thread1. If there is a need for a form to call an object in another form, programmer must explicitly define a way so that the calling form first check if the owner of the object to be called is loaded or not.
I am inviting you to join GreenZap. It is just like PAYPAL but it is more rewarding! You get $25 when you join (FREE to sign up) AND you get rewarded also when someone opened an account using your GreenZap promo code! GreenZap is launching June 1st.
Click here and PREREGISTER
Have a break. Visit JonelsPlace
August 5th, 2004, 01:15 AM
Oddly enough, I've seen cases where a simple single-form program won't completely unload on a system running winME, but on other OS's it's ok. I used End as the last line of code after the form unloads, which seems to have solved the problem.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
August 5th, 2004, 04:23 AM
Well...are you sure that all forms are unloaded...? You can check it within the 'Query_Unload' evetn of the main dialog...add the following
Dim FormX as Form
For Each FormX in Forms
if FormX.hWnd<> Me.hWnd then
Debug.Print "Form is still loaded"
August 5th, 2004, 09:03 AM
Avoid End command
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
Click Here to Expand Forum to Full Width