:cheesy: Brief Intro: I am new to Visual Basic but have been playing with a USB PC Interface and have got to grips with some VERY basic VB6 commands and am trying to expand my "vocabulary" with hopefully the help of your kind and learned selves.

Best Wishes for the Festive Season and here goes.

I want to set a timer from a button click to run for ten minutes then go off, but can only get the timer in vb6 to run for 10000 milliseconds ! any help would be great.


Thanks Newbie Dogfish

P.S.

Sorry for posting in the wrong area before this ( you know what we're like, play with the remote first, then read the manual when you can't get it working)

I want to set a timer from a button click to run for ten minutes then go off, but can only get the timer in vb6 to run for 10000 milliseconds ! any help would be great.

I don't know why you can't go higher than 10000, I just loaded a timer with 60000 -- 1 minute. 70000 was too large.

Regardless, you can just count the number of times the timer kicks off, and when it gets to the 10-minute count, you're done.

Hi,

Set these properties for Timer Control :
Interval = 10000
Enabled = False
Place A Command Button cmdStart on the Form.
Caption ="Start"

Keep a Form Level Variable MyTime

Dim MyTime As Long
 
Private Sub cmdStart_Click()
    MyTime = 0
    Timer1.Enabled =True
    cmdStart.Enabled = False    
End Sub
 
Private Sub Timer1_Timer()
    MyTime = MyTime +1
    If MyTime >= 60 Then 
        MyTime = 0
        Timer1.Enabled = False
        MsgBox "Time Out!!"
        cmdStart.Enabled = True
    End If
End Sub

I Hope It IS Clear
Regards
Veena

This article has been dead for over six months. Start a new discussion instead.