Article ID: 162084
Article Last Modified on 12/3/2003
** Returnfail.prg - demonstrates failure of
** RETURN TO MASTER in a class error method
DEFINE CLASS returntest AS custom
PROCEDURE init
CLEAR
USE HOME()+"samples\data\customer"
ERROR 12, "MyError"
*LOCATE FOR CustHeight="Steve" && No such column in table
=MESSAGEBOX("It didn't return to master")
ENDPROC
PROCEDURE error
LPARAMTERS nError, cMethod, nLine
=MESSAGEBOX("The error is " + STR(nError,2,0) + ;
" in " + cMethod +" method.")
RETURN TO MASTER
ENDPROC
ENDDEFINE
** Tryfail.prg - program to test the failure of
** RETURN TO MASTER in a class where the error is
** caused by a LOCATE FOR fault.
CLEAR
CLOSE ALL
SET PROCEDURE TO returnfail
oRef = CREATEOBJECT("returntest")
=MESSAGEBOX("It did return to master")
MODIFY COMMAND returnfail
ERROR 12, "MyError"
*LOCATE FOR CustHeight="Steve" && No such column in table
Remove the asterisk from the second line, and place an asterisk to the
left of the first so that the lines look like:
*ERROR 12, "MyError"
LOCATE FOR CustHeight="Steve" && No such column in table
Save that program.
Additional query words: vfoxwin kbdsd
Keywords: KB162084