I am trying to create a countdown that if the app is shutdown while it is still counting, it should continue from last count when the app is restarted. For instance: I have a countdown which counts down from 360 to 0. If the countdown is currently in 120, and the app is shutdown, i would like the countdown continues from 120 instead of starting all over from 360, whenever the app is restarted. So far, i have the following code. The countdown works but the My.Settings.countdown doesn't seems to work. When i stopped the app and restarted it, it doesn't start from where the counting was when i aborted the app. Someone please help fix this. Thank you very much for the timely response and past assistance.
Public Class frmMain
Dim WithEvents Timer5 As New System.Windows.Forms.Timer 'Make a new timer
Dim TimerCounter2 As Integer = 3600 'Starting Value
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lblCoutdownReader2.Text = My.Settings.countdown
lblCoutdownReader2.Text = CStr(TimerCounter2)
Timer5.Interval = 1000 'Set the interval (milliseconds)
Timer5.Start()
If lblCoutdownReader2.Text = 0 And TxtActivationKeyStore.Text <> "6564WEDR3432GFD657" Then
PanelAppActivation.Visible = True
End If
End Sub
Private Sub Timer5_Tick(sender As Object, e As EventArgs) Handles Timer5.Tick
TimerCounter2 -= 1 'DeIncrement the counter
lblCoutdownReader2.Text = CStr(TimerCounter2) 'Show the counter
If TimerCounter2 = 0 Then 'Countdown reached 0
Timer5.Stop() 'Stop the Timer
PanelAppActivation.Visible = True
Button101.Enabled = False
End If
End Sub
End Class
