Shows an error dialog to the user. - CSharp System.Windows.Forms

CSharp examples for System.Windows.Forms:Dialog

Description

Shows an error dialog to the user.

Demo Code


using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;
using System.IO;/*from   w  ww  .  ja v  a2  s  . co  m*/
using System;

public class Main{
        /// <summary>
        /// Shows an error dialog to the user.
        /// </summary>
        public static void ShowError(String message)
        {
            MessageBox.Show(message, " Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            try
            {
                String logFile = Path.Combine(PathHelper.LOG_DIR, "Exceptions.log");
                File.AppendAllText(logFile, message + "\n\r\n\r");
            }
            catch { /* NO ERRORS */ }
        }
}

Related Tutorials