Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pressing Escape to answer No for Message Box 1

Status
Not open for further replies.

Kflasph

Programmer
Apr 8, 2002
65
US
I have a basic Yes No message box where I would like the user to be able to press escape when the message box appears as a 'No' answer.

Is there a way to do this ?

Kflasph
 
They can already just type "n" for No for a vbYesNo MsgBox, will that work?

They can type ESC for "Cancel" with a vbYesNoCancel or vbOkCancel MsgBox.
 
You can trap the keystroke in the KeyPress event using the constant for "Escape" (think it's vbEscape, but not sure).

All I ask is a chance to prove that money can't make me happy.
 
They want to be able to press the Escape button sooo

If I capture the keystoke - how do I relate it to the Message box?

Kflasph
 
>They want to be able to press the Escape button

Its not standard in a Windows interface and their want should be diplomatically dismissed unless they can convince Microsoft too.
 
If you're bound and determined to have this functionality, ditch the msgbox and create a custom form with yes & no buttons (which can be unloaded when you capture the keystroke).

All I ask is a chance to prove that money can't make me happy.
 
Thanks for the input - I was hoping there was a way to do this without having to build a custom form.

Thanks again,
Kflasph
 
If you do create your custom form, just set the Cancel property of the NO command button to True. If you do that ESC activates the button code

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Since MicroSoft couldn't be convinced ; ) ...
We went with the user just pressing Enter or "N" - I set the MsgBox to default to the No button when presented.

Thanks for all of the responses
 
One point to make in favor of not deviating from Microsoft's standard UI behaviors is that you increase productivity. The reason for this is that a new hire will be able to leverage past experience to come up to speed rather than having to learn the idiosyncracies of your particular UI. This translates into money, and people are generally quick to set aside their ideas when you explain that they cost money.
 
Yo Yo Yo Yo Bob.
& a star.

All I ask is a chance to prove that money can't make me happy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top