Click to See Complete Forum and Search --> : Timer In VB


Ehsan
May 2nd, 2001, 04:50 AM
Hi All

I want to use timer in a VB program, but i don't know how I can use it.

Could someone pls help me?

Thanks

Ehsan

vinodgaikwad
May 2nd, 2001, 05:04 AM
select timer and press F1 man ! dont u know such a simple thing :-)

Curt
May 2nd, 2001, 06:26 AM
'Place a timer control, 2 command buttons and
'a textbox on a form, use default names. then
'do something like this

Dim counter as Long

private Sub Form_Load()
Timer1.Enabled = false
Timer1.Interval = 1000 '1 sec
End Sub
private Sub Command1_Click()
If Timer1.Enabled = false then
Timer1.Enabled = true
End If
counter = 0
End Sub

private Sub Command2_Click()
If Timer1.Enabled = true then
Timer1.Enabled = false
End If
End Sub

private Sub Form_Load()
Timer1.Interval = 1000 '1 sec
End Sub


private Sub Timer1_Timer()
counter = counter + 1
Text1.Text = counter
End Sub





Curt