Task manager close is not detected second time in C# !!!

Posted by Samir on Stack Overflow See other posts from Stack Overflow or by Samir
Published on 2010-04-02T04:47:01Z Indexed on 2010/04/02 4:53 UTC
Read the original article Hit count: 283

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        if (e.CloseReason == CloseReason.UserClosing)
        {
            if (MessageBox.Show(this, "Do you really want to close?", "Close?", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                e.Cancel = true;
            }
        }
    }

So when I want to close the application clicking the close button the message box is shown as it should, then I chose no. Then the line e.Cancel = true is executed and the form is not closed.

Now the thing is, after this if i close the application from task manager the close reason is UserClosing !!! Why? Shouldn't it be TaskManagerClosing?

© Stack Overflow or respective owner

Related posts about c#

Related posts about taskmanager