As per your inquiry about why I don't return.
This statement is inside a do loop. If it has an exception I want to
restart the do loop with the next iteration immediately and not run the
rest of the code in the loop--or skip the rest of the code in the loop.
If you'd seen my post on "I miss loop" from 3/14 you'll know that this
was a sticky situation. If I exit do it LEAVES the loop. I no longer
have the command to initiate an immediate jump to the next iteration.
In this section of code if an exception occurs I display it in labels on
the form in case someone is looking but there is little that can be done
about it by the program except try the next loop iteration. So in this
case I really only catch exceptions to keep them from messing up my
execution. The code following the command is looking to see what's in
respstr already. I didn't want to have to set another variable to
indicate an exception occured so respstr can't be trusted. Of coure as
has been suggested, and is a good idea I could ensure respstr is blank
in the catch. But why add an extra line. I know respstr is empty
before the command is run and I SHOULD know if throwing an exception
would put put anything in it.
Peter Huang [MSFT] wrote:
Hi,
If the exception occured when we call the proxy.validate( soapmesg), then
respstr will be untouched.
Also if you do not continue the process in the function, why not just
return in the catch.
If you have finally code, just put it in the Finally block.
You may try to run the code below.
Try
Throw New Exception("Test ")
Catch ex As Exception
MsgBox(ex.ToStr ing())
Return
Finally
MsgBox("Finally called")
End Try
If you still have any concern, please feel free to post here.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.