Assuming the code:
MessageBox.Show(this,
"Would you like the differential girdle spring on the up-end of the grammeters?",
"Smi-Boloid Stater Slots",
MessageBoxButtons.YesNo,
MessageBoxIcon.Warning);
If the user presses Escape, i want it to close the message box, and the Show()
method can return DialogResult.None
.
Related question: How can i enable the "X" in the upper-right of a MessageBox.Show to let the user abort?
Kind of like how a Windows Explorer confirmation dialog lets you press escape to abort.
Kind of like how an Internet Explorer confirmation dialog lets you press escape to abort.
Kind of like how an Outlook confirmation dialog lets you press escape to abort.
Kind of like how every dialog in the history of the universe lets the user press escape ,or click X, in order to say:
"I have no earthly idea what you're asking me, please just don't break my computer."
From the Vista UX Guidelines
Use Yes and No buttons only to respond to yes or no questions. The main instruction should be naturally expressed as a yes or no question. Never use OK and Cancel for yes or no questions.
You have to enable the "Cancel" option with the enum value "MessageBoxButtons.YesNoCancel"
This will return DialogResult.Cancel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With