Hi, guys,
I have a web app with a built-in stopwatch timer.
First, there are the following global variables that I’ve created in a module (all Integers):
- StartTime
- FinishTime
- SpentTime
- SpentTimeMin
- SpentTimeSec
The stopwatch is designed to stop at 10 min.
There is the following code in the button that starts the stopwatch.
StartTime=Microseconds/1000000
FinishTime=StartTime + 600
Timer1.Mode=2
Pressing that button starts the timer with the following code
Dim CurrentTime as Integer
Dim Seconds as String
CurrentTime=Microseconds/1000000
SpentTime=CurrentTime - StartTime
SpentTimeMin=SpentTime/60
SpentTimeSec=SpentTime - SpentTimeMin*60
if SpentTimeSec<10 then
SpSec="0" + str(SpentTimeSec)
else
SpSec=str(SpentTimeSec)
end
if RemainingTime<=0 then
me.mode=0
end if
if TextArea1.Enabled=False and StartTime=0 then
Label3.Text="00:00"
else
if SpentTimeMin<10 then
Label3.text= "0"+ str(SpentTimeMin) + ":" + str(SpSec)
else
Label3.text= str(SpentTimeMin) + ":" + str(SpSec)
end
end
Label3 is the GUI element that displays the elapsed time.
Everything works well except for one thing - if I run this app in two different browser windows, the app in the second window resets the timer in the first window.
My uneducated guess is that this happens because the code is executed on the server side. Am I mistaken?
What is the best way to fix it so that these stop watches do not reset each other when the app is used by multiple users?
Thank you in advance.
Val