jackjohnson44
asked on
c# better sleep
I wrote a program that does something every 10 seconds. I am using a sleep, but the program seems to lock up duding the sleep. Is there a better way to do this so the program is not locked up and will respond to a button press? Basically I start the process wiht one button and it loops 1000 times until another button is pressed and a flag is set to false. Currently I have to keep pressing the stop button since the program seems to lock.
System.Threading.Thread.Sl eep(5000);
Thanks
System.Threading.Thread.Sl
Thanks
ASKER
can you please privide some code, I don't really understand.
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can do what you want by using a System.Timer. Start it up, and it will fire an event each time the ttimer fires. You can do what you need in the event handler.
Jim