Keep WinForm open on own thread


G

George Rice

Hi,

I have a situation where I have a sub that is started on its own thread. The
sub opens a form which is supposed to stay open, and it does open for a
brief flash, but as soon as the sub ends, the form goes away.

This behavior makes sense to me, but I'm wondering how I can keep the form
open until the user is done filling it in, then close the form and abort the
thread.

Thanks in advance,

-George
 
Ad

Advertisements

C

ClayB [Syncfusion]

Are you calling Application.Run to run your form?

private void button1_Click(object sender, System.EventArgs e)
{
Thread thread = new Thread(new ThreadStart(LauchNewThread));
thread.IsBackground = true;
thread.Start();
}

private void LauchNewThread()
{
Form1 f = new Form1();
Application.Run(f);
}

=================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top