Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Code for Setting Timer

Status
Not open for further replies.

dead7

Programmer
Jun 8, 2004
79
US
I need code for setting the timer in visual basic, a sample will do.
 
Maybe there is more to your question then is in the help file, but

Code:
Dim PauseTime, Start, Finish, TotalTime
If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
    PauseTime = 5    ' Set duration.
    Start = Timer    ' Set start time.
    Do While Timer < Start + PauseTime
        DoEvents    ' Yield to other processes.
    Loop
    Finish = Timer    ' Set end time.
    TotalTime = Finish - Start    ' Calculate total time.
    MsgBox "Paused for " & TotalTime & " seconds"
Else
    End
End If

[/code}
 
Or is it the form timer?

[tt]me.TimerInterval = 1000 ' milliseconds -> 1 second[/tt]

in the forms on load event, will make the forms on timer event fire each second.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top