Try inside Try

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
 
A

Armin Zingler

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)
 
D

Dennis

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?
 
C

Cor

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
 
M

mp

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top