FormClosing事件里Application.Exit()要弹出两次的解决办法

买了个表!
关闭时候,用this.this.Close(); 一直关不掉,用 Application.Exit(); 要关闭两次,以下解决办法是关闭只弹出一次
private void MainFrm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (DialogResult.OK == MessageBox.Show("提示信息", "请选择", MessageBoxButtons.OKCancel))
            {
               // this.Close();
                this.FormClosing -= new FormClosingEventHandler(this.MainFrm_FormClosing);//为保证Application.Exit();时不再弹出提示,所以将FormClosing事件取消
                Application.Exit();
            }
        }

 

posted @ 2013-05-27 14:41  宁静思远  阅读(432)  评论(0编辑  收藏  举报