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
 Philippines
 Dale Dedoroy
 To: Shaun Longworth
  Where is Shaun Longworth?
 Saskatoon
 Canada
 Shaun Longworth
 Tags
Subject: RE: Quitting
Thread ID: 22801 Message ID: 22809 # Views: 30 # 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
EndIf

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.

Dale

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

COMPLETE THREAD