Click to See Complete Forum and Search --> : App Closing
Chronovore
May 4th, 2001, 11:28 AM
I have a function that is to run when my app is closed. I stuck it in the form's terminate event and it runs like it's supposed to when I use the menu to exit or a command button to exit. Now, when I try to use the close box at the top, it doesn't run. Is there a way I can get this to work? What kind of event happens when someone shuts down the app this way?
Iouri
May 4th, 2001, 11:39 AM
In the QueryUnload event of a form you can check to see if the X buton was pressed
private Sub Form_QueryUnload(Cancel as Integer, UnloadMode as Integer)
if UnloadMode=0 then
'Do What You Like
Cancel=true
end if
End Sub
This will stop the form unloading if they press the "X". Unloadmode will also be 0 if they try to close
the form from its own menu (By click on the icon in the top left corner)
Iouri Boutchkine
iouri@hotsheet.com
Chronovore
May 4th, 2001, 11:53 AM
Now I have the problem that the program does not close when the x box is pushed. When I step through the program it runs my function when it is pushed, but the app does not close. What should I put in there to make it close the app?
Chronovore
May 4th, 2001, 11:59 AM
Nevermind, I figured out if you remove the
Cancel = 0
it quits the app. Thanks so much for your help!
Iouri
May 4th, 2001, 12:56 PM
rate it if it helped you
Iouri Boutchkine
iouri@hotsheet.com
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.