Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exit button newbie

Status
Not open for further replies.

GOOGE

Technical User
Jun 20, 2001
36
0
0
NZ
hi

is it possible to unload all form when the user clicks the X at the top right to exit the form.

the problem i have with my program is that i have a form running in the background that is not visable,if the us clicks the X to exit then the form in the background is still running. can i make it so when the exit out of say form1 then for2 will unload.

i have tried sub form1 unload but it doesnt seem to work


cheers
james cuttance
 
Private Sub Form1_Unload()
Dim x
For Each x In Forms
Unload x
Next
End Sub
 
hi
you just put End statement in the form unload event. it may solve your problem
 
In the Unload() event

unload form.name(background form)
unload me
end

this will close the both forms and end all processes.
 
Microsoft warns against using the end event because it is supposedly very sloppy, Ie it does not always clear the memory like unload me. For an example End is ramming your car into a wall @ 60 m/h to stop it, Unload is rolling to a gentle stop.


Just my .02 Dollars. Brad,
Free mp3 player,games and more.
 
thanks guys it a helped.now its working fine.


cheers heaps

james
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top