VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Delay execution of code for a Number of seconds.

by Stanley Campbell (1 Submission)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Thu 18th February 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Delay execution of code for a Number of seconds.

Rate Delay execution of code for a Number of seconds.





Private Sub Timer2_Timer()
Dim DelayTime As Long
Dim EndTime As Long

   DelayTime = 22 'Set Delay in Seconds.
   EndTime = Format(Time, "s") + DelayTime
   If EndTime > 59 Then
      'Make sure Seconds is Not Greater than 59.
      EndTime = EndTime - 59
   End If
   Do Until Format(Time, "s") = EndTime
      'Yields execution so that the operating system can process other events.
      DoEvents
   Loop
   'Turn Timer Off.
   Timer2.Enabled = False
End Sub


Download this snippet    Add to My Saved Code

Delay execution of code for a Number of seconds. Comments

No comments have been posted about Delay execution of code for a Number of seconds.. Why not be the first to post a comment about Delay execution of code for a Number of seconds..

Post your comment

Subject:
Message:
0/1000 characters