Spawn a new thread to open a new window and close it from a different thread

I bet what you’re doing is something like this:

new Thread(() => new TestForm().Show()).Start();

because this makes the window disappear immediately, like you describe.

Try this instead:

 new Thread(() => new TestForm().ShowDialog()).Start();

ShowDialog spins its own message pump, and only returns when the window is closed.

Leave a Comment