Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ON ERROR Macro Substitution
Message
From
03/06/2013 13:05:54
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP3
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01575512
Message ID:
01575523
Views:
32
This message has been marked as a message which has helped to the initial question of the thread.
>Hi Gang!
>
>question.... I have, in some old code, a routine that may or may not have an ON ERROR error handler activated when starting the code.
>
>Any way to save what the rest of the ON ERROR part is, to a variable, at that point? Any function that tells what the ON ERROR part is?
>
>Then, I can change the ON ERROR handler to be what I want it to be and run my new code....
>
>And if the user changes their mind and exits the routine without running my new part, it can restore back whatever the ON ERROR was to begin with, just like nothing has happened.
>
>Thanks!

One other thing to supplement the info from others -- An Error() trap in an object (if it is within the call stack) will take precedence over ON ERROR (at least as far as VFP6 -- hadn't tested if this is also true in VFP7,8 or 9). For example, if you've got an Error event defined in a form, you'll discover that that the form's Error() will trigger instead of the ON ERROR that is defined within the PRG that is called by a form's method. I first got bitten by this when adapting some old FPW code to VFP and used some ActiveX controls as part of the update (namely the Common Dialog control -- as the built-in GETFILE()/PUTFILE() in VFP6 had the limitation of not being able to navigate with UNC paths, and when using the Common Dialog control, you have to have an Error trap to handle some conditions -- otherwise you get a runtime error).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform