Hi,
I have a MDIParent and forms that i want to show as child. But because each individual child performs heavy tasks I want each child to have it's own thread.
here's what I am trying to do...
void showStartPage()
{
Form1 p = new Form1();
p.MdiParent = this;
p.Show();
}
private void ShowNewForm(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(showForm));
t.SetApartmentState(ApartmentState.STA);
t.Start();
}
Here showForm is the function that needs to be started in a new thread so that i can start a new form. But i get an exception when using the line
p.MdiParent = this;
It says.."Cross-thread operation not valid: Control 'MDIParent1' accessed from a thread other than the thread it was created on."
I want to know how i can create new forms in a new thread.
Any help is greatly appreciated
Thank you