Hi all, I'm working on a small project in Visual Basic 6 which involves a timer. I'm looking for it to resume counting from where it was when last used even if it has not been opened. Say it was opened on the 01/22/2014 at 13:00 and the timer was set to 02/22/2014 13:00. So from the first launch it would take the current date and time and count down 24 hours even if the application was closed.
My original method was to use a timer and resume from where it left off on the next opening but that would not work. This was what I had coded:
How would I go around doing what I'm trying to do? I'm completely lost now.
My original method was to use a timer and resume from where it left off on the next opening but that would not work. This was what I had coded:
Code:
Dim Countdown As Date
Countdown = "23:59:59"
Private Sub Form_Load()
Timer1.Interval = 1000
t.Text = GetSetting(App.EXEName, "Startup", "v", "")
Countdown = GetSetting(App.EXEName, "SS", "x", "")
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode _
As Integer)
SaveSetting App.EXEName, "Startup", "v", t.Text
SaveSetting App.EXEName, "Startup", "x", Countdown
End Sub
Private Sub Timer1_Timer()
Countdown = Countdown - (1 / 24 / 60 / 60) 'Subtract Seconds
t.Text = Format(Countdown, "hh:mm:ss") 'Display
End Sub