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

Re: Keep WinForm open on own thread by ClayB

ClayB
Fri Aug 22 05:02:00 CDT 2003

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

"George Rice" <george.r@starband.net> wrote in message
news:OdtxmsEaDHA.3436@tk2msftngp13.phx.gbl...
> 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
>
>