Newbie Spellweaver
- Joined
- Oct 16, 2008
- Messages
- 85
- Reaction score
- 0
Timer.Interval = 120000
I have used mostly all my command button names and such as Quit/Check/Guess/End and so it. It has never messed up my code. Please do not insult my teacher. As for your suggestion... I have no idea what to search for so that was absolutely no help at all. Thanks anyway.Don't have to. IDK who your teacher is but... >.> Epic phael.. "Timer" can not be the name of a timer without messing up code. Rename it to timer1 or whatever you want, but because timer is initially referred to as a keyword, you'll have error. Other possible reason is it's too high for whatever vb uses to store integers, so you'll have to google creating longs in vb or something along those lines. Otherwise, there is absolutely nothing wrong with the code, idk what the hell your teacher is thinking about.
You're supposed to set the interval via the Timer's Properties window.
Timer.Interval = 120000
Run Time Error '308':
Invalid Property Value
>.> Well obviously you didn't read what I said. IT CAN'T BE CALLED TIMER WITHOUT HAVING ERRORS! Just name it timertest or timerlol or timer1 or tmr or whatever you wanna call it BESIDES TIMER! *spazzes out*
Dim xtimer
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub
Private Sub Timer1_Timer()
xtimer = xtimer + Val(1)
Label1.Caption = "Time: " & xtimer & " sec."
If xtimer = 120 Then
MsgBox "2min!"
End
End If
End Sub
You can do it like how he has put it in the code.You're supposed to set the interval via the Timer's Properties window.
Timer1.Interval = [b]"[/b]120000[b]"[/b]
The timer can have any names <.<
The timer interval can't go over 65535... so you will have to use more timers or make a code that counts to 2min.
Here is some help:
Make a Timer named: Timer1
And then a Label named: Label1
Then use this codes:
Code:Dim xtimer Private Sub Form_Load() Timer1.Interval = 1000 End Sub Private Sub Timer1_Timer() xtimer = xtimer + Val(1) Label1.Caption = "Time: " & xtimer & " sec." If xtimer = 120 Then MsgBox "2min!" End End If End Sub
And further it saysMSDN Online said:Property Value
Type: System.Int32
An Int32 specifying the number of milliseconds before the Tick event is raised relative to the last occurrence of the Tick event. The value cannot be less than one.
Remarks
The Int32 value type represents signed integers with values ranging from negative 2,147,483,648 through positive 2,147,483,647.
Private Sub Timer_Timer()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Timer2.Enabled = True
End Sub
Private Sub Timer2_Timer()
Timer3.Enabled = True
End Sub
Private Sub Timer3_Timer()
'put what you want to happened after two minutes here
End Sub