private void Master_FormClosing(object sender, FormClosingEventArgs e)
{
int n = int.Parse(MyClass.Dlookup("select count(*) from stock where Stock.ISUpload=0"));
if (n > 0)
{
if (MessageBox.Show("数据上传未完成,是否一定要退出程序", "Confirm Message", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
isRunning = false;
this.Dispose();
}
else
{
}
}
else
{
isRunning = false;
this.Dispose();
}
}使用FormClosing事件,无论点击messagebox的确定或者取消都会关闭按钮,这是为什么?
{
int n = int.Parse(MyClass.Dlookup("select count(*) from stock where Stock.ISUpload=0"));
if (n > 0)
{
if (MessageBox.Show("数据上传未完成,是否一定要退出程序", "Confirm Message", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
isRunning = false;
this.Dispose();
}
else
{
}
}
else
{
isRunning = false;
this.Dispose();
}
}使用FormClosing事件,无论点击messagebox的确定或者取消都会关闭按钮,这是为什么?
{
e.Cancel = false; int n = int.Parse(MyClass.Dlookup("select count(*) from stock where Stock.ISUpload=0"));
if (n > 0)
{
if (MessageBox.Show("数据上传未完成,是否一定要退出程序", "Confirm Message", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
isRunning = false;
this.Dispose();
}
else
{
e.Cancel = true; }
}
else
{
isRunning = false;
this.Dispose();
}
}
{
int n = int.Parse(MyClass.Dlookup("select count(*) from stock where Stock.ISUpload=0"));
if (n > 0)
{
if (MessageBox.Show("数据上传未完成,是否一定要退出程序", "Confirm Message", MessageBoxButtons.OKCancel) == DialogResult.OK)
{
isRunning = false;
this.Dispose();
}
else
{
e.Cancel = true;//取消关闭窗体事件
}
}
else
{
isRunning = false;
this.Dispose();
}
}
你的关闭按钮是啥意思???
取消关闭窗体事件是:e.Cancel = true;
e.Cancel = true;跟踪代码了看下...