I am working on a multi-threaded application. Say I create a Form1 on the
main thread and call form1.ShowDialog. This Form1 is only displaying status
information. There is no real user interaction going on. I do all the
background processing on a worker thread and I only update Form1 using Invoke
commands. If I create a form on the worker thread is there a way to make
Form1 the owner of the new form?
Also, if I want to display a MessageBox on the worker thread is there a way
to make Form1 the owner so the MessageBox belongs to the main form and
doesn't get lost or buried?
I was trying to do:
newForm.ShowDialog(form1);
and
MessageBox.Show(form1, "message");
With .NET 2.0 I get the "cross-thread operation not valid" error.
Do I need to invoke form1 to create and display form2? Do I need to invoke
form1 to display the message boxes? Or is there an easier way?