Pausing Program Execution - 5 Minutes

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

    Pausing Program Execution - 5 Minutes

    Hi:

    I'm trying to write a routine that will permit my VB.NET program to
    pause execution for five minutes and try a task again if there is a
    failure. After a set number of tries it should return a failure
    notification.

    I know how to do everything except make it hibernate for five minutes -
    if anyone knows how to do this I would GREATLY apprecaite it!

    =============== =============== ==============
    Logially:

    dim error_counter as integer = 0

    while error_counter < 10

    if callmainfunctio n()
    ' it worked - return
    return .t.
    endif

    ' add one to the error counter:
    error_counter += 1

    ** wait five minutes

    "system.sle ep(5 minutes)"

    end while

    return .f.
    =============== ===========

    Thanks very much!

    Fred
  • Fred Nelson

    #2
    Re: Pausing Program Execution - 5 Minutes

    Hi Again:

    I found that:

    system.threadin g.thread.sleep( miliseconds)

    works just fine!


    Fred Nelson wrote:[color=blue]
    > Hi:
    >
    > I'm trying to write a routine that will permit my VB.NET program to
    > pause execution for five minutes and try a task again if there is a
    > failure. After a set number of tries it should return a failure
    > notification.
    >
    > I know how to do everything except make it hibernate for five minutes -
    > if anyone knows how to do this I would GREATLY apprecaite it!
    >
    > =============== =============== ==============
    > Logially:
    >
    > dim error_counter as integer = 0
    >
    > while error_counter < 10
    >
    > if callmainfunctio n()
    > ' it worked - return
    > return .t.
    > endif
    >
    > ' add one to the error counter:
    > error_counter += 1
    >
    > ** wait five minutes
    >
    > "system.sle ep(5 minutes)"
    >
    > end while
    >
    > return .f.
    > =============== ===========
    >
    > Thanks very much!
    >
    > Fred[/color]

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: Pausing Program Execution - 5 Minutes

      * Fred Nelson <fred@smartybir d.com> scripsit:[color=blue]
      > I found that:
      >
      > system.threadin g.thread.sleep( miliseconds)[/color]

      Notice that this will block your app's user interface when calling this
      method from within your main thread.

      --
      Herfried K. Wagner [MVP]
      <URL:http://dotnet.mvps.org/>

      Comment

      • Fred Nelson

        #4
        Re: Pausing Program Execution - 5 Minutes

        Herfried:

        I have noticed that and in this case its OK. I force a status box that
        I'm using to perform a .UPDATE() so I can see what's going on.

        Thanks for your help!

        Fred

        Herfried K. Wagner [MVP] wrote:[color=blue]
        > * Fred Nelson <fred@smartybir d.com> scripsit:
        >[color=green]
        >>I found that:
        >>
        >>system.thread ing.thread.slee p(miliseconds)[/color]
        >
        >
        > Notice that this will block your app's user interface when calling this
        > method from within your main thread.
        >[/color]

        Comment

        • Cor Ligthert

          #5
          Re: Pausing Program Execution - 5 Minutes

          Fred,

          And when not, you can set it in a simple loop doing it 300 times a second
          and place in that loop

          application.doe vents

          Just a simple addition.

          Cor
          [color=blue]
          > Herfried:
          >
          > I have noticed that and in this case its OK. I force a status box that
          > I'm using to perform a .UPDATE() so I can see what's going on.
          >
          > Thanks for your help!
          >
          > Fred
          >
          > Herfried K. Wagner [MVP] wrote:[color=green]
          > > * Fred Nelson <fred@smartybir d.com> scripsit:
          > >[color=darkred]
          > >>I found that:
          > >>
          > >>system.thread ing.thread.slee p(miliseconds)[/color]
          > >
          > >
          > > Notice that this will block your app's user interface when calling this
          > > method from within your main thread.
          > >[/color][/color]


          Comment

          Working...