0
Reply

launch new Form/thread that doesn't close with main App

Alexander Fielding

Alexander Fielding

Mar 10 2008 2:40 PM
5.6k

I want to launch a new independent Form from my application such that it doesn't close when the main application Form closes.   How do I get started on this? 

Presently I launch the new Form via

MyForm f = new MyForm();

f.Show();

I tried changing the f.Show() to

Application.Run(f);

but then I get an InvalidOperationException "starting second message loop on a single thread is not a valid operation. Use Form.ShowDialog instead"

I tried creating a new thread ala Thread, but that still seems to close out when the original application Form closes.