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);
}
}
How to check completion of thread
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Jul 9, 2014, 2:16 AM EDT
this.Invoke((Action)(() => button4.Enabled = true));
Guest UserRank #259 · 9.8K reputationPosted Jul 9, 2014, 1:51 AM EDT
Farhan ShariffRank #2,004 · 725 reputationPosted Jul 9, 2014, 2:55 AM EDT