469,609 Members | 1,445 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Retry on exception

Hi,
It may a simple question but i needed to verify. I hava a for-next
loop and when an exception occurs, i don't want my program to the jump
out of try-catch block and i want it to retry the operation again.

Here is what i meant:

Try

Dim x as integer
For x=0 to 10
<Codeline1>
Next

Catch
'Error message
<Codeline2>

End Try

'Operation ended
<Codeline3>
At this code when the program processing for example 3rd (x) item in
for-next loop and if an exception is thrown, <Codeline2is executed
as well, then it jumps to <Codeline3>.

My aim is that when an exception is thrown on any for-next (x) item,
the program must ignore it or notice as messagebox then "continue"
processing operation till it reaches the end of for-next loop (x=10)
instead of jumping outside try-catch block and interrupting operation.

How can i do this?

Thanks!
Feb 10 '08 #1
3 1250
Kimi,

As I understand you well, then normally I would set the try and catch
complete inside the for loop.

Cor

Feb 10 '08 #2

"kimiraikkonen" <ki*************@gmail.comkirjoitti viestissä
news:23**********************************@v46g2000 hsv.googlegroups.com...
Hi,
It may a simple question but i needed to verify. I hava a for-next
loop and when an exception occurs, i don't want my program to the jump
out of try-catch block and i want it to retry the operation again.
On Error Goto...
On Error Resume

Try looking for these keywords.

-Teemu

Feb 10 '08 #3
On Feb 10, 1:38 pm, "Cor Ligthert[MVP]" <notmyfirstn...@planet.nl>
wrote:
Kimi,

As I understand you well, then normally I would set the try and catch
complete inside the for loop.

Cor
Thanks Teemu and Cor, i put try-catch block inside my loop and works.
Feb 10 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.