Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Quit an Application
Message
De
11/01/2003 16:35:20
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
 
 
À
11/01/2003 15:57:08
John Tomblin
Service Station Systems, Inc.
San Jose, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00740696
Message ID:
00740702
Vues:
28
> on error do GiveUp
> open database MyData shared
>
> *------------------------------------------------
> procedure GiveUp
>
> =MessageBox("Helpful Hints ...")
> close all
> clear all
> quit
> cancel
> return
>
>All I want to do is to display a message and terminate.When the database cannot be opened, the messagebox does appear but, the application continues to run and produce error after error.

I tested this with the following code:
SET STEP ON 

ON ERROR DO GiveUp
USE c:\NoFile
MESSAGEBOX("Got here")

*------------------------------------------------
PROCEDURE GiveUp

MESSAGEBOX("Helpful Hints ...")
*CLOSE ALL
CLEAR ALL
*QUIT
CANCEL
RETURN
The "Got here" box came up once while the VFP8 Toolbox was closing (CLEAR ALL). I found the following in the ON ERROR Help:
"Specifies the Microsoft Visual FoxPro command to execute. After the command executes, program execution resumes on the line immediately following the line that caused the error...ON ERROR procedures cannot be nested. If ON ERROR is issued within an ON ERROR procedure, the default Visual FoxPro error handler is restored."

I wonder if somehow you are getting a second error - maybe in the CLEAR ALL - ane triggering the default VFP error handler which somehow takes you back up to the code following your database opening code. I've seen odd things happen when you hit an error inside an error routine.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform