By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,187 Members | 1,038 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,187 IT Pros & Developers. It's quick & easy.

Retry on exception

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a

"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

P: n/a
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.