Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Dale Dedoroy
  Where is Dale Dedoroy?
 Bacolod City, Negros Occidental
 Dale Dedoroy
 To: Shaun Longworth
  Where is Shaun Longworth?
 Shaun Longworth
Subject: RE: Quitting
Thread ID: 22801 Message ID: 22809 # Views: 2 # Ratings: 0
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Saturday, April 26, 2003 7:39:26 AM         

> Within our program we have ON ERROR code. When we encounter certain errors we would like to have our program exit gracefully. Whenever this error is encountered we are issuing a QUIT statement. We have ON SHUTDOWN code which closes the environment and the tables and clears events, etc. but after this is executed the code within the UNLOAD event of the Form is being processed which is causing errors.
> Is there anyway to bypass the unload code so that it just simply quits??
> Any help would be greatly appreciated.
> Thank you in advance.
> Shaun Longworth

Create a public var, say , _glQuitApp in your main program and set this as .F. in your shutdown procedure, set this var to .T. somewhere when the user decided to quit your app. In your form's unload method you may add the lines:

If !_glQuitApp
*** your code here

Therefore, your code within the IF/ENDIF statement will only fire if you normally close the form. It won't fire if you quit the entire app. You may create a form class so that you don't have to go over all of your form's and put the proper modification code. Goodluck.


"Man's mind once stretched by a new idea never regains its original dimension."


Quitting Posted by Shaun Longworth @ 4/25/2003 8:56:07 PM
RE: Quitting Posted by Dale Dedoroy @ 4/26/2003 7:39:26 AM