Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trapping an Error
Message
 
 
À
23/04/2000 10:21:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00362580
Message ID:
00362593
Vues:
13
As John Durbin said, you have to manaully pass the error up the containership hierarchy. But this may not solve your problem.

When you release the form, the form's release process starts. What this means is that the Release method fires which fires the Destroy method. Once that happens, the code, if any, immediately after the code that caused the error in the form control will fire. When the program queue is clear, the form control's Destroy methods will fire because they were released when the form was released; however, no clean up was done.

You will need a RETURN TO clause in your Error event. The return statement can be used to return control to any program or procedure in the call stack. If you release the form, in the error event you should return control to the program, procedure or method that launched the form. Ex.
Save.Error
LPARAMETERS nError, cMethod, nLine
THISFORM.Error(nError, cMethod, nLine)

Form.Error
LPARAMETERS nError, cMethod, nLine
=MESSAGEBOX("An Error Occoured in " ; + cMethod + ;
+CHR(13)+"This Form will be closed",16+0+0,"Error Handler")

RELEASE ThisForm
return to master  && or return to formlauncher
I've only tested this using singular instances of method names in the call stack. I don;t know how this will play out if, for example, you have multiple Click methods from multiple controls in the stack. You'll have to sort one out for yourself *g*.

HTH.

>If I have a method code that causes an error and I want to use the Error Event to stop processing the code and release the form what syntax do I use. Currently the code will continue to process. How do you make the form.error respond to a child method error?
>
>
>Save.Error
>LPARAMETERS nError, cMethod, nLine
>=MESSAGEBOX("An Error Occoured in " ; + cMethod + ;
>+CHR(13)+"This Form will be closed",16+0+0,"Error Handler")
>
>RELEASE ThisForm
>
>Thanks in advance
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform