|
-
Jul 18th, 2000, 08:38 PM
#1
Thread Starter
Frenzied Member
Anybody had this before?
I have an application that Ends with a command button something like this
Command1_Click()
Unload Me
End
End Sub
Then I can CTRL+ALT+DEL and the program is still running even after I have exited through the command button.
This application is already in .EXE format if that makes any difference.
Thanks.
-
Jul 18th, 2000, 08:49 PM
#2
If you have any forms still loaded in memory or any loops still executing with DoEvents in them then the application won't close. Make sure all loops exit and try:
Code:
Private Sub Command1_Click()
Dim oForm As Form
For Each oForm In Forms
If oForm.Name <> Me.Name Then Unload oForm
Next
Unload Me
End Sub
-
Jul 18th, 2000, 08:51 PM
#3
You may also want to do something like Set Form1 = Nothing to rid any resources it uses.
-
Jul 18th, 2000, 08:54 PM
#4
Hyperactive Member
Sometimes unloading forms just isn't enough...
If you created a form as an instance of the object, used it then you need to make sure you set the variable back to "nothing" even after you have unloaded it.
Code:
Dim frmMine as New MyForm
MyForm.Show vbModal
Unload MyForm
Set MyForm = nothing
If you have done this "EVERY" time you created a new form then it should close correctly... it hangs around (which you should notice hangs around in your development environment because it doesn't stop even when you close the last form) because it still thinks there is something going on inside with a form that is just hidden, or unloaded but still active.
Rather than do the check through forms at the end I would carefully study your code to find out where you are NOT unloading it, Better to fix the source than always try to tidy up sloppy coding at the end.
-
Jul 18th, 2000, 09:12 PM
#5
Thread Starter
Frenzied Member
thanks
all sound like good advice
thanks all
-
Jul 18th, 2000, 09:14 PM
#6
Thread Starter
Frenzied Member
X box closing
oh, sorry
one last question
Does closing an application via the X box also unload all forms in the application?
-
Jul 18th, 2000, 09:21 PM
#7
The X button is refered to in the Query_Unload statement..anything put there will do something when you click the X button.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|