Click to See Complete Forum and Search --> : Simple timer problem
August 1st, 2000, 03:35 PM
I want to start a timer when a command button is pressed on one form and
i want to stop timing when a command button is pressed on another form. How can
this be done. How does the other form know there is a timer running?
August 1st, 2000, 08:30 PM
On First Form
private Sub Command1_Click()
'Turn timer on
Timer1.Enabled = true
End Sub
On Second Form
private Sub Command2_Click()
If Form1.Timer1.Enabled = true then
'Timer is running
Form1.Timer1.Enabled = false
else
'Timer is not running
End If
End Sub
Alternate for Second Form
(Turn it off without checking it)
private Sub Command3_Click()
'Ensure timer is turned off
Form1.Timer1.Enabled = false
End Sub
August 2nd, 2000, 04:27 AM
Thanks. That works, but i heard it was bad programming practice to do it that way although i can't see a way round it!
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.