Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Try/Catch
Message
 
 
To
07/08/2007 11:07:30
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01246493
Message ID:
01246494
Views:
29
Why do you need TRY..ENDTRY? It sounds like IF..ENDIF or DO CASE will do.

>In the TRY block I want to test for certain conditions, if those conditions prove false, then I want to go to the CATCH block and do some other stuff. I think I should use THROW, but I can't figure out how to do it. I'm new to using the TRY/CATCH stuff.
>
>
>TRY
>
>   Bunches of code...
>
>CATCH TO oException (come here if a variable in the TRY block proves false - not sure I even need oException here)
>
>   IF oException.ErrorNo = 1
>      STRTOFILE("Error occurred at: " + TRANSFORM(DATETIME());
>         + CHR(13),"C:\Errors.log",.T.)
>   ENDIF
>
>FINALLY
>
>   RETURN .T.
>
>ENDTRY
>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform