In my program.cs file, the code is as follows:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
frmWizard frm = new frmWizard();
Application.Run(frm);
Thread th = new Thread(frm.ThreadSetCom);
th.Start();
}
ThreadSetCom is a method that runs in an endless loop checking for something. I noticed that ThreadSetCom will only execute just before the WinForm appears and after i close the form. It doesn’t execute while the Form is visible. Can anyone clear this up to me please?
Application.Run waits until the passed form in argument is closed. You may need to
createandstartthethreadin theloadevent of the frmWizard.