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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Esc to discard YesNo Msgbox

Status
Not open for further replies.

Schweiger

Programmer
Apr 26, 2002
122
CH
Does anybody know how to get the escape-key to have the same effect as clicking No in a msgbox with the buttons yes and no. I know, that this can be done with OK Cancel, but if there would be a simple trick to get it to work with yesNo too I would be glad.

thanks in advance for any suggestions
Andreas
 
If you don't get any better ideas, may I suggest that you design a form that emulates the MsgBox then you can have it respond to ESC or anything else.
 
The best I can come up with is use vbYesNoCancel instead of vbYesNo. That way, Esc is the same as Cancel, but you'll still have Yes and No on the message. Not a great solution, but I'm afraid that's all you'll get unless you make your own MsgBox function that does what you want.

BTW, VB Message Boxes have a limit of 1000 characters that can be displayed in the message. Your own message box could display large messages in a list box with a scroll bar. Your message box could have constants for button combinations such as "Sure" and "Nah". It may be worth the effort to make your own.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top