Hey Guys,
I am trying to stop processing code in a class and return to the from with an error. When it ty the return; method it only takes me out of the class and back into the form class and keeps executing code.
What is the code that I should use to return to my form.
Thanks,
Loading

AlanRank #669 · 3.6K reputationPosted Dec 5, 2007, 1:41 PM EST
If you're calling a class method from your form, then try placing the method call inside a try/catch block. Any exceptions which are thrown but not handled by the code in the class method, should then be caught and handled in the form.
Alternatively, if you want to handle the exception in the class method but indicate to the form that the exception has occurred, use the return value of the method, or a 'ref' parameter, to notify the error. The code in the form can then examine the return value or 'ref' parameter to see whether an error occurred and, if it did, take the appropriate action.
Blake Arnold28 reputationPosted Dec 5, 2007, 2:24 PM EST
Blake Arnold28 reputationPosted Dec 5, 2007, 2:29 PM EST
I was thinking if I set it to bool then I can just run a simple if loop to check wheather it worked or not.
Thanks,
Ryan AlfordRank #1,411 · 1.2K reputationPosted Dec 5, 2007, 5:29 PM EST
AlanRank #669 · 3.6K reputationPosted Dec 6, 2007, 12:32 AM EST