WPF MessageBox close without any action
Posted
by developer
on Stack Overflow
See other posts from Stack Overflow
or by developer
Published on 2010-06-01T15:06:37Z
Indexed on
2010/06/01
15:13 UTC
Read the original article
Hit count: 132
Hi, I have a confirmation message box for the user in one of my apps. Below is the code for that,
MessageBoxResult res= System.Windows.MessageBox.Show("Could not find the folder, so the D: Drive will be opened instead.");
if (res == MessageBoxResult.OK)
{
MessageBox.Show("OK");
}
else
{
MessageBox.Show("Do Nothing");
}
Now, when the user clicks on the OK button, I want certain code to execute but when they click on the red cross at the upper right corner, I just want the messagebox to close without doing anything. In my case I get 'OK' displayed even when I click on the red cross icon at the upper right corner. Is there a way I can have 'Do Nothing' displayed when I click on the cross. I not want to add any more buttons.
© Stack Overflow or respective owner