I need to generate a timer code in VB that counts down from 3600000 miliseconds (1 hour) to 0 miliseconds.But it's not allowing value to exceed 65000 something....my present code is as follows.....

Private Sub Timer1_Timer()
If Label2.Caption = 0 Then
Timer1.Enabled = False
MsgBox ("1 Hour is up")
Else
Label2.Caption = Label2.Caption - 1
End If
End Sub

Please pleeeeeaseeeee help me......!!!

Thankkkkk you!!!!! :)

I did not understand what exactly your code does, but here is a simple solution:

Set the timer interval to 60000 millisecond (1 minute)
Declare a new variable and let it be MyVar
We'll increase the variable each minute, when it reaches 60, that will be an hour
Here's the code:

Option Explicit
Dim MyVar as Integer

Private Sub Timer1_Timer()
MyVar = MyVar + 1
If MyVar = 60 Then
     Timer1.Enabled = False
     Msgbox "1 Hour is up."
End If
End Sub

And I'm ready for any further help!

Note: If this problem is solved, then please mark this thread as solved. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.