Close Reason for closing program in C#
===

I'm trying to detect whether or not the user have save their work before closing the program. I've tried the below coding:

       void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
                MessageBox.Show("Unsave Work");
        }
But it does not work. Nothing happen when I close the program. What do u guys think?