locked
C# Thread Application cannot be closed completely... RRS feed

  • Question

  • Hi all,

    I use simple threads in my C# application which is a C# Windows Application having a simple form that contains a start processing and a stop processing button. Program works fine.

    But when I try to close the application by clicking the stop processing button, the process is not being closed even the form closes. In the task manager, that process is seems running in background. I then have to kill that process in order to start it again.

    The mouse click event of that button is as the following:

    private void stopButton_Click(object sender, EventArgs e)
    {
         this.Close();
    }

    If I do not use threads, the exe is being closed completely
    .
    What do I need to do to solve this problem?
    Thanks...

    Wednesday, January 17, 2007 11:25 AM

Answers

  • Try: Application.Exit();

    It forces message pumps to be terminated before closing the application.

    Wednesday, January 17, 2007 11:54 AM