How to make a thread stay runnig in c#

Posted by menachem on Stack Overflow See other posts from Stack Overflow or by menachem
Published on 2010-03-18T12:02:53Z Indexed on 2010/03/18 12:31 UTC
Read the original article Hit count: 294

Filed under:
|
|

Hello,
I have a Windows Form Application (Form1) that allow the user to open another Forms (FormGraph). In order to open the FormGraph App I use a thread that open it.
Here is the code that the thread is running:

private void ThreadCreateCurvedGraph()
{
    FormGraph myGraph = new FormGraph();
    myGraph.CreateCurvedGraph(...);
    myGraph.Show();
}

My problem is that myGraph closed right after it's open.
1) Does anyone know why this is happening and how to make myGraph stay open?
2) After the user closed myGraph, How do I terminate the thread?
Many thanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about thread