Hi all,
I am using VB 6.0, and want to use a Timer in order to decrement GMS NumLED from 3:00 to 0:00, I have tried, but program crashes after first run.
So, I made a simple application in which I only included the NumLED, Timer, and a Start label. There are no errors, code compiles and runs fine, I have tried to debug it too, all program flow is as expected, but it doesn't decrement the NumLED. I would be very thankful for any suggestions, links or fix, or even a hint about, what could have gone wrong?
I am attaching complete code here for reference:
Code:
' simple program to decrement NUM LED timer using timer component
Option Explicit

' Label start click event
Private Sub lblStart_Click()
    Timer1.Enabled = True
End Sub

' Timer tick event
Private Sub Timer1_Timer()
    Static timeValue As Integer
    timeValue = 10
    Do While (timeValue <> 0)
        timeValue = DecrementNumLedTime(timeValue)
        NumLED1.Value = timeValue
    Loop
    Timer1.Enabled = False
End Sub

' Decrementing NumLED timer
Public Function DecrementNumLedTime(ByVal timeValue As Integer) As Integer
    Static quotient As Integer
    Static remainder As Integer
   
        remainder = timeValue Mod 60
        quotient = timeValue / 60
  
    DecrementNumLedTime = remainder - 1
End Function