I’m trying to make a countdown timer in my app. I already know the countdown time which is 4 minutes. I have a Timer which ticks every seconds. Now from that how can I update my TextBox so that it shows the time remaining in the format HHMMSS?
EDIT: the problem I’m having is calculating the remaining time. What should I use? Timestamp?
Before you start counting down, note the current time using something like
Then when your tick events occur, you can figure out how much time is left using
You can format timeLeft as needed, possibly using .ToString(‘hh:mm:ss’) mentioned by Jared
You can read the docs on TimeSpans and DateTimes for more info on how to use them.