Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TRY/CATCH question
Message
From
18/01/2010 14:49:49
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01444571
Message ID:
01444603
Views:
56
>>I am fairly new to TRY/CATCH, since I just started using VFP 9 fairly recently, for some clients.
>>
>>Now, my question is, why can't I do a RETURN from within the CATCH clause? I already found a workaround, just set a variable and then conditionally exit. But I was wondering about the reason - just hoping to get a more profound understanding of the relevant aspects. So, why would VFP not allow the RETURN directly from the CATCH clause?
>>
>>(Now that I am asking this, I am starting to think it might be related with the need to inconditionally execute the FINALLY clause - which I don't happen to have in this particular case. Can somebody confirm this?)
>
>Here is the exam question
>
>
>public void methodname()
>{
>  try
>  {
>    Console.Writeline("A");
>    int val = int.Parse("8A");
>    Console.Writeline("B");
>  }
>  catch(Exception ex)
>  {
>    Console.Writeline("C");
>    return;
>  }
>  finally
>  {
>    Console.Writeline("D");
>  }
>  Console.Writeline("E");
>}
>
>
>Possible results
>
>a) ABCDE
>b) ACD
>c) A0BDE
>
>(It was written by chrissie1 in LessThanDot forum).

The only result your going to get there is :
'System.Console' does not contain a definition for 'Writeline'
(g)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform