Unloading and stoping the run
I have a simple VB program with several forms. One thing that started today is that when I run my program in design mode and I have my debug toolbar on I can start my program runing by clicking on the blue start triangle. The program runs ok but after I unload all my forms and ME the blue square box (the end button) does not go away until I click on it. This to me would indicate that something is still loaded but I have very spicificaly unloaded everything and I can see they are all unloaded. Any Idea's of how I can find out why the program is not quiting altogather ?
[579 byte] By [
AM003295] at [2007-11-11 8:43:22]

# 3 Re: Unloading and stoping the run
END is a pretty harsh way to stop your program. It just kills the app and may leave things hanging around in memory.
Comment out the end. Then start checking all your forms and objects. Are you properly cleaning them up when finished (setting them = nothing)?
So, for each form, you have something like this:
Unload frmWhatever
Set frmWhatever = Nothing
Same with most objects. If you declare an ADO Command object, you should set it = nothing when done.
If you clean up all your objects, your app will close by itself.
# 4 Re: Unloading and stoping the run
That's better, I do have a ADO on 4 of my forms but I'm having trouble setting them to nothing.
My form = LocationTable and my ADO = datprimaryRs so I
Set LocationTable.datprimaryRs = Nothing
which is giving me an error
# 5 Re: Unloading and stoping the run
1. The initial post did say 'but after I unload all my forms', so one would expect that this had been done.
2. 'I do have a ADO on 4 of my forms but I'm having trouble setting them to nothing' - no mention made of this in the initial post either - unfortunately my crystal ball is not working at the moment ... 'END' was not suggested as the first step after the user clicks 'Close' ... :-)
gupex at 2007-11-11 17:29:10 >

# 6 Re: Unloading and stoping the run
I found the problem. It was that in my project I have the usual "About" form and I load string information into the labels when my MAIN form initializes. Even though I do not show this About form it still needed to be unloaded. Once I unloaded it all was good.
# 7 Re: Unloading and stoping the run
as soon as you acces a screen element of a form (in this case a Label of the About form), the form loads automatically, even if not shown.
To fix this problem, put this code in the main Form Unload event:
on error resume next
dim frx as form
for each frx in Forms
unload frx
next
Marco
mstraf at 2007-11-11 17:31:10 >
