Do you provide a warning before the program exits?
  v2.0 Posted at 8/05/2013 4:53 PM by Rebecca Liu

​A product should not close without providing a warning. We use the following message box to warn the user before closing a program:

SSW Exchange Reporter - Are you sure you want to exit?
Figure: Good Example - Standard warning before a program exits
        private void OnExit(object sender) 
                EventHandler handler = ExitRequest; 
                if (handler!= null ) 
                   handler(sender, EventArgs.Empty);
                string closeTitle = string.Format("Exiting{0}", Application.ProductName);
                string closeMessage = string.Format("Are you sure you want to exit {0}", Application.ProductName);
                DialogResult result = MessageBox.Show(closeMessage,closeTitle, MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
We have an example of this in the SSW .NET Toolkit.

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address: