For example
Your current code in the method of the thread looks like
public void ThreadMethod()
{
....
SubForm form = new SubForm();
...
form.Show();
...
}
Rewrite it to
public void ThreadMethod()
{
...
CallFormShow(form)
...
}
protected delegate void CallFormShowDelegate();
protected void CallFormShowInvoke()
protected void CallFormShow()
{
mainForm.Invoke(new CallFormShowDelegate(CallFormShowInvoke), new object[]{});
}
protected void CallFormShowInvoke()
{
SubForm form = new SubForm();
...
form.Show();
}
Hope this could help you.
Your current code in the method of the thread looks like
public void ThreadMethod()
{
....
SubForm form = new SubForm();
...
form.Show();
...
}
Rewrite it to
public void ThreadMethod()
{
...
CallFormShow(form)
...
}
protected delegate void CallFormShowDelegate();
protected void CallFormShowInvoke()
protected void CallFormShow()
{
mainForm.Invoke(new CallFormShowDelegate(CallFormShowInvoke), new object[]{});
}
protected void CallFormShowInvoke()
{
SubForm form = new SubForm();
...
form.Show();
}
Hope this could help you.