Try inside Try

  • Thread starter Thread starter mp
  • Start date Start date
M

mp

If I have 2 try "levels"

eg:
Try '...try1outer level

....do some stuff

Try 'Try2 inner try

DoSomethingMayError()

Catch ex As Exception

m_Util.Logentry("Error " & ex.Message)

Exit Try '<----- does this exit try2 or try1?

End Try'2

End Try'1


thanks
mark
 
Am 15.07.2010 16:46, schrieb mp:
If I have 2 try "levels"

eg:
Try '...try1outer level

....do some stuff

Try 'Try2 inner try

DoSomethingMayError()

Catch ex As Exception

m_Util.Logentry("Error " & ex.Message)

Exit Try '<----- does this exit try2 or try1?

End Try'2

End Try'1


Try it. ;)

(exits only inner try. like exit do, exit for)
 
If I have 2 try "levels"

eg:
Try '...try1outer level

....do some stuff

Try 'Try2 inner try

DoSomethingMayError()

Catch ex As Exception

m_Util.Logentry("Error " & ex.Message)

Exit Try '<----- does this exit try2 or try1?

End Try'2

End Try'1

Have you traced it (stepped thru line by line) in the debugger to see
what happens?
 
Yes very nice, shows you understand why the Try and Catch blocks has
advantages on Resume on error.

It acts like every nested block the end try is the end of the inner block.

I advice it often to get a connection error separated from a read error.

Cor
 
Cor said:
Yes very nice, shows you understand why the Try and Catch blocks has
advantages on Resume on error.

It acts like every nested block the end try is the end of the inner block.

I advice it often to get a connection error separated from a read error.

Cor

thanks all,.
next time i'll try first
sorry
mark
 
Back
Top