3
Reply

How to check completion of thread

Farhan Shariff

Farhan Shariff

Jul 9 2014 5:46 AM
810
I want to enable button4 once all the if conditions in  GoCheck fuction is completed  




private void button4_Click(object sender, EventArgs e)
        {
         
   try
     {
                button4.Enabled = false;
                Thread t1 = new Thread(GoCheck);
               t1.IsBackground = true;
                t1.Start();
                 
            }
            catch
            {
                MessageBox.Show("Critical Error Check Input Files");
            }
        }


        private void GoCheck()
        {
     try
         {
                //----CODE--------------------------------------------       
               //----CODE-------------------------------------------- 
               //----CODE-------------------------------------------- 
             //----CODE-------------------------------------------- 

       
                if (duplicates_1.Count == 0 && duplicates.Count == 0 && asList.Count == 0)
                {
                    MessageBox.Show("Input Successfully Verified");
               }

          }
     catch
            {
                   MessageBox.Show("Check Input File and  Restart");                                                              
                   Environment.Exit(0);
            }

        }



Answers (3)