|
-
Oct 31st, 2008, 01:57 AM
#1
Thread Starter
New Member
Unable to decrement numeric LED in my ActiveX Control
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|