Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trapping an Error
Message
De
23/04/2000 13:08:29
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00362580
Message ID:
00362600
Vues:
17
Larry,

Thanks for the reply.

That helped me understand... Now I get things to shut down after only two errors.. The cause of the error is a missing table but what I am trying to do is a gracefull exit instead of generating 25 errors because of a missing or crapped out table...

I added some code to show the line and for some reason it does not bail out until after the second error that is 4 lines down in the code...

I'm close...

Thanks


>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform