Originally Posted by
Shaggy Hiker
Yeah, it can be done. You're going to need one or five variables at form scope (not in any method). Five variables will be easiest in some ways, but if the number may change, you might consider using a single Integer rather than five Booleans.
Assuming that you are using five Booleans, then when each button is clicked, set one of the Booleans to True. You will also need a timer with an interval of 1000 (1 second). When each button is clicked, stop, then start, the timer. This will cause it to reset its interval. If the timer Tick event ever fires, then 1 second has elapsed since the last button click. Therefore, in the Tick event, stop the timer and clear all five Booleans.
There is one other case you will need to deal with: Once the fifth Boolean has been set, you will not be needing the timer. Whether you should stop it or not is a bit hard to say. After all, the timer tick isn't going to do anything other than clear the Booleans and stop the timer, so you might just let it tick that one time after the fifth button has been clicked. It all comes down to whether or not you want the Booleans to be left in the set or cleared state (if you leave them set you will need some other means to clear them or else you won't be able to click them again). In any case, after any button is clicked, you would call a method that would check all five Booleans and play the sound if all five are True. If you want to leave them True, you'd also disable the timer in that method.