Waiting between commands

Hi

Is it possible to let vb wait a few seconds before it wil excecute the next command



Answer this question

Waiting between commands

  • Sam Jarawan MSFT

    That looks like a job for a timer object. Check out the Timer class.


  • jjbval

    You can tell the application to wait until all pending actions have completed by using Application.DoEvents(). Otherwise, you could force the entire application to pause for a certain amount of time by using Threading.Thread.Sleep(pauseLengthInMilliseconds).


  • Mrrenzo

    Thnxs it worked :D
  • shal

    Isn't there an other way I have made a simple sprite and I want to make it jump, but it moves so fast that you cant see it and I want to take a short rest between the times he moves.

    to be a little clearer her's the script

     

    If e.KeyCode = Keys.Up And rtrn = 0 Then

    Pos.Y -= 3

    'I want him to wait here for a short time but not a program freeze

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y -= 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Pos.Y += 3

    Dir = "upr"

    Frame += 1

    If Frame = 7 Then Frame = 1

    Loc = "img/" & Dir & Frame & ".gif"

    Me.Invalidate()

    End If


  • Waiting between commands