Steps to create a count down timer OCX In Visual Basic 6.0
Creating a count down timer can be tricky even for an advanced programmer, the idea of a counter is almost the same except we count down in this case, counting up as a default counter relies on adding (1) to the value of an integer variable in a timer tool, and the best example for this is the (Clock / Timer) where you put:
Label1.Caption = Now
in a timer control whose interval is (1000 ms) and finaly in (Form_Load) event you triger the (Timer1_Timer) event by setting its (Enabled) value = (True).
In our example (The Count Down Timer) we don't just inverse the previous process, we create a new method as shown in the source code. The idea of a count down timer is : variable integer = value minus (-1, -2, -3, ......) another integer variable in a timer i.e. (Sec) integer variable = 10, 10 is start of the down-counter, in the timer event (Sec = Sec - 1), but if we finished at this point, we won't get anything, the result will be infinite , and here lies the trick, we must do checking for sec's value (if = 0 then exit sub or anything) then label1.Caption = Sec, only then we will see a count down to (0).
Here is the source code for the example above, try to enhance it the way you like by adding some codes in the Sub Reset().
Source Code at MediaFire.com
As an extension to this Count Donw Timer i developed a CountDownTimer.OCX file to be used on Visual Basic 6.0 Projects.The Ocx is deployed and ready to setup and also deployed in Source Code uploaded at MediaFire.com Link.
CountDnTmr1.Speeding = NormalCountDnTmr1.Trigger 10
Command1.Caption = ("Visibilty Is : " & CountDnTmr1.IsShown)
End Sub
You can create events depend on it. IsShown : If set to true the the count down timer will be visible, otherwise it won't be The event (IsCounting) : Double click on the CountDownTimer, in the IsCounting Event, place thise code -
If CountDnTmr1.Cnt_Donw_Sec = 0 Then
Me.WindowState = vbMaximized
CountDnTmr1.IsShown = Not CountDnTmr1.IsShown
Command1.Caption = ("Visibilty Is : " & CountDnTmr1.IsShown
It is really simple and helpful to use and to develop also, it's a good free material to start your own OCX developing, so Good Luck.