Retry on exception

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kimiraikkonen

    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!
  • Cor Ligthert[MVP]

    #2
    Re: Retry on exception

    Kimi,

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

    Cor

    Comment

    • Teemu

      #3
      Re: Retry on exception


      "kimiraikko nen" <kimiraikkonen8 5@gmail.comkirj oitti viestissä
      news:2388de25-a50b-437f-a23e-f5edb9fee891@v4 6g2000hsv.googl egroups.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

      Comment

      • kimiraikkonen

        #4
        Re: Retry on exception

        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.

        Comment

        Working...