I have a form that is used like a dialog, to be sure that the dialog get the correct parent the following method is used :
this.ShowDialog(myForm);
The problem is that this(my dialog form) and myForm is created on diffrent threads and when calling ShowDialog a crossthread exception will be thrown.
this.InvokeRequired = false
myForm.InvokeRequired = true
How do I handle this? Do I have to make sure that both are created on the same UI thread?
You have to ensure that all forms are created on the UI thread.
So rather than create the form on your background thread, pass a message to the UI thread to tell it to create and display the form.