我在调试程序的时候总是会自动退出,每次都使用了SqlDataAdapter.fill()或者update后就会跳到一个地方,这个地方是
protected override void Dispose(bool disposing){
    if(disposint && (components!=null)){
       compnents.Dispose();
    }
    base.Dispose(disposing)
}每次都先跳到主界面的这个位置,然后会跳到当前窗口的同样上面方法的位置,然后程序就自动退出了,没有任何错误提示,现在很着急啊,那位高手大概知道问题出在哪里吗?先谢谢了

解决方案 »

  1.   

    将下面这段代码加到progrm.cs里,程序退出时就会有错误日志,而且有错误的行号提示。
       static Program()
            {
                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            }        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
            {
                string strException = string.Format("{0}发生系统异常。\r\n{1}\r\n\r\n\r\n", DateTime.Now, e.ExceptionObject.ToString());
                File.AppendAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SystemException.log"), strException);
            }
      

  2.   

    try
    {
    //异常代码
    }
    catch(Exception ex)
    {
    Messagebox.Show(ex.Message);
    }