Question

I am creating a game and I want the player to only be allowed on one form for approx. 15 seconds or depending on the question on the form, it may be a sooner time such as 7 seconds but for the timer it is only in milliseconds, will i have to make it 7000 for the interval or if there is a more simple way could someone lead me onto the correct path? im not asking for code just for a direction to go with this, thanks :) if you need more information because i did not explain it very well just ask and ill do my best.

Was it helpful?

Solution

It's exactly as you say. If you want to do something after 7 seconds then you set the Interval of a Timer to 7000. Interval is an Integer so it can support values over 24 days.

Actually, another option for one-off actions nowadays is the Task.Delay method. I'd go with the Timer though, because you will need to act on the UI thread and the Task will act on a secondary thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top