Hi Everybody !
I need your help to solve the following issue please:
In my Window Form application I run a waiting form while I am executing some procedures.
This waiting form is run in a thread.
In running time, the first execution of my thread works fine but I cannot run it at the second try.
According to the documentation I have found on internet, It seems we cannot execute a thread more than ounce but I do not know how to implement my solution by using another method.
Here is my code (it is executed by clicking on a button):
It would be great if someone could guide me.
Thank you very much !
I need your help to solve the following issue please:
In my Window Form application I run a waiting form while I am executing some procedures.
This waiting form is run in a thread.
In running time, the first execution of my thread works fine but I cannot run it at the second try.
According to the documentation I have found on internet, It seems we cannot execute a thread more than ounce but I do not know how to implement my solution by using another method.
Here is my code (it is executed by clicking on a button):
C#:
private void WaitFormRun()
{
// Execute my Waiting Form
Application.Run( WF );
}
Thread LoadingThread = new Thread( WaitFormRun );
try
{
LoadingThread.Start();
MyProcedure1;
switch( GetFileServerTag() )
{
case 1:
MyProcedure2;
break;
case 2:
MyProcedure3;
break;
}
}
catch (Exception E)
{
MessageBox.Show(E.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Logger.WriteLog("Error message: " + E.Message);
}
finally
{
// Close my Waiting Form
WF.Close();
}
It would be great if someone could guide me.
Thank you very much !
Last edited by a moderator: