Start with the debugger: put a breakpoint on the End Sub line of your frmGame_Load method, and look at exactly what is in
time
- I'm guessing it is 300.
But...after that you don't change the value! So the numbers you show never change.
You can just use
time = time - 1
as the first line of your Timer1_Tick method, and that will work - but I'd do it differently.
Create a class level DateTime variable, and call it "endTime"
When you read the time from the DB, set endTime to the current time, plus the timer value:
endTime = DateTime.Now.AddSeconds(time)
Then in your cdtimer method, compare the endtime and current time:
Dim diff as TimeSpan = endTime - DateTime.Now
If diff.totalSeconds > 0 Then
lblMin.Text = diff.ToString("mm")
lblSec.Text = diff.ToString("ss")