A
AP
Hi,
I'm trying to use c# to pop up a dialog box when a user attempts to close
word to prompt them if they want to exit or cancel (obviously other stuff
needs to happen based on their selection but that's the gist of it.)
I have everything set up, and it seems to work except that setting Cancel to
true and returning from my c# method appears to do nothing. Word still
closes. Am I doing something wrong?
private void wa_DocumentBeforeClose(Document Doc, ref bool Cancel) {
DialogResult dr =
MessageBox.Show("Update Template File on the Server?","Update Template
File",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question,MessageBoxDefaul
tButton.Button1);
//If they cancel go back to word
if (dr == DialogResult.Cancel) {
Cancel = true;
return;
//word still closes
}
//If they say yes upload to server
if (dr == DialogResult.Yes) {
//do yes stuff
}
//NO - do nothing except
}
Adam
I'm trying to use c# to pop up a dialog box when a user attempts to close
word to prompt them if they want to exit or cancel (obviously other stuff
needs to happen based on their selection but that's the gist of it.)
I have everything set up, and it seems to work except that setting Cancel to
true and returning from my c# method appears to do nothing. Word still
closes. Am I doing something wrong?
private void wa_DocumentBeforeClose(Document Doc, ref bool Cancel) {
DialogResult dr =
MessageBox.Show("Update Template File on the Server?","Update Template
File",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question,MessageBoxDefaul
tButton.Button1);
//If they cancel go back to word
if (dr == DialogResult.Cancel) {
Cancel = true;
return;
//word still closes
}
//If they say yes upload to server
if (dr == DialogResult.Yes) {
//do yes stuff
}
//NO - do nothing except
}
Adam