In C#, I have two Forms: mainForm and form1.
class Form1; //...
class mainForm {
//...
void f() {
Form1 form1 = new Form1();
...
}
}
I want to wait for the form1 to exit and continue the following work in the mainForm. But I don’t know the form1 is implemented as a process or a thread and how to get its ID.
Thanks.
It is neither. It runs on the same UI thread as your other form(s) unless you go out of your way to do something clever, with the message pump handling messages to all of them.
What is it that you want to do? Normally keeping the reference to the second form instance is sufficient for sending messages, etc.
To wait for the second form to finish, use
ShowDialog(), or if you are in a form,ShowDialog(this).