In my windows application i have a usercontrol, which in turn host few other usercontrols.
Just before the end of the main user control's constructor, i try to create a thread... but it does not appear to be created:
mainUserControl()
{
var t=new Thread(ThreadJob);
t.IsBackground=true;
t.Start();
}
private void ThreadJob()
{
//Thread.Sleep(120000);
//if(txtStatus.InvokeRequired) {
// txtStatus.Invoke(new MethodInvoker(delegate { txtStatus.Text="Thread started"; }));
//}
txtStatus.Text="sample";
}
This code does not work: i take this as evidence that the thread is not spawned, as if it were then txtStatus.Text="sample";
would have thrown an exception.... right?
So what's happening here? Why isn't my thread being created?