|
-
Mar 22nd, 2000, 11:31 PM
#1
Thread Starter
Hyperactive Member
PLEASE HELP ME
Can I please ask what everyone else does to handle program terminations?
I want my program to unload,kill, remove, and otherwise stop running any time someone hits the little X in the corner or some selects quit.
My project has 4 forms in it. sometimes only 3 are loaded.
When one gets loaded I keep it in memory so that the user can go back to it the way they left it.
How can I handle the removal of all forms and stop the exe from running when any X gets hit or the user selects quit?
thank you for your time and have a good day
-
Mar 23rd, 2000, 12:23 AM
#2
Thread Starter
Hyperactive Member
I would be very thankful for any advice on the subject.
thank you for your time and have a good day
-
Mar 23rd, 2000, 12:59 AM
#3
Fanatic Member
Re : Unloading
Badger,
Create a global module. In this module create a sub, and do the following
eg.
sub myUnload()
unload form1
unload form2
unload form3
unload form4
end sub
in the unload events of yuor forms, insert code to kill and objects etc. then call myUnload()
so in each of the forms unload events, do someting similar to
private sub form_Unload(cancel as integer)
set myobject = nothing
myunload
end sub
Iain.
-
Mar 23rd, 2000, 02:56 AM
#4
Thread Starter
Hyperactive Member
thank you very much that helped me out a lot
-
Mar 23rd, 2000, 03:08 AM
#5
transcendental analytic
This will always close all forms no matter what their names are:
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
'close all sub forms
For i = Forms.Count - 1 To 1 Step -1
Unload Forms(i)
Next
End Sub
-
Mar 24th, 2000, 01:01 AM
#6
Fanatic Member
unloading without names
kedaman,
I have tried what you have suggested before, and the program went into a continous loop and stopped responding.
However i see your point that it does allow you to unload any form without having to know the name.
The folllowing method works without crashing.
Code:
Private Sub Form_Unload(Cancel As Integer)
Dim form As form
For Each form In Forms
Unload form
Next
End Sub
Iain.
-
Mar 24th, 2000, 03:17 AM
#7
transcendental analytic
That code i wrote works fine in my apps. But if one or more of your apps crash with it, I will copy your version. But I wonder if there really is anything that differs from yours.
-
Mar 24th, 2000, 02:37 PM
#8
New Member
Public Sub UnloadAllForms()
Dim Form As Form
For Each Form In Forms
Unload Form
Set Form = Nothing
Next Form
End Sub
crack
-
Mar 27th, 2000, 02:53 AM
#9
Lively Member
why dont you just do:
private sub form_unload(cancel as integer)
end
end sub
surely that would just terminate the whole thing easier, prolly not the best way but would certainly work!
-
Mar 27th, 2000, 02:58 AM
#10
Thread Starter
Hyperactive Member
it was my understanding that end would not free up all the resources.
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
|