troubleshooting Question

Repeating a task every few minutes

Avatar of Desired_Username
Desired_Username asked on
Programming Languages-OtherC#Windows OS
6 Comments1 Solution975 ViewsLast Modified:
Im trying to process an event every x minutes after a button has been pressed in a windows form.  The current way im doing it uses a loop which shows the form as not responding after a few minutes.

Help as soon as possible please this has to be handed in soon



//Button press
        private void button2_Click(object sender, EventArgs e)
        {
                DoProcess();
                button2.Enabled = false;
        }
 
        private void DoProcess()
        {
            for(int a = 0; ;a++)
            {
                ////do the stuff here...... and min window
                this.WindowState = FormWindowState.Minimized;
                Thread.Sleep(40000);
            }
        }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros