Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How Do I Reset the Timer in Visual Basic?

Status
Not open for further replies.

rfidp

Electrical
Nov 24, 2002
2
0
0
US
I have the following code:
Private Sub cmdDisplay_Click()
Dim intZone1 As Integer
Dim intZone2 As Integer
Dim intZone3 As Integer
Dim intZone4 As Integer

intZone1 = 1
intZone2 = 2
intZone3 = 3
intZone4 = 4

If (txtID.Text = 1) Then
txtFinalZone.Text = intZone1
End If

If (txtID.Text = 2) Then
txtFinalZone.Text = intZone2
End If

If (txtID.Text = 3) Then
txtFinalZone.Text = intZone3
End If

If (txtID.Text = 4) Then
txtFinalZone.Text = intZone4
End If

If (txtID.Text = 0) Then
Call Timer1_Timer
Else
If (txtID.Text = 1) Then
Reset Timer "I WANT TO RESET THE TIMER IN THIS LINE"
"HOW CAN I DO THAT?"
End If
End If

End Sub


Private Sub Timer1_Timer()

Call Beep

End Sub

THANKS IN ADVANCE
 
Replies continue below

Recommended for you

I'm not sure what you mean by resetting, but I thing Timer1_Timer.Enable = True will turn on the timer, and Timer1_Timer.Enable = False will turn it off. Hope that helps.
 
If Timer is a system function you may not be able to reset it to 0. The usual way of using it in other languages is just to store the value of timer at the point at which you wanted to zero it, say call it timer0 and then use timer()-timer0 from then on.

Cheers

Greg Locock
 
Status
Not open for further replies.
Back
Top