Intelligent MsgBox

How can I accept the ESCAPE key as a NO on a MsgBox, without designing a form that looks like a msgbox?
SylvaniaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AnswerTheManCommented:
MsgBox "hi", vbYesNoCancel
0
SylvaniaAuthor Commented:
Like I stated in my question, I want the NO to be pressed when I press the ESC key.  I didn't think I had to mention the vbYesNo was in use.  I'm tired of using vbYesNoCancel where the NO and the Cancel do exactly the same thing.
0
EDDYKTCommented:
MsgBox "hi", vbOKCancel + vbDefaultButton2
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

SylvaniaAuthor Commented:
Like I stated in my question, I want the NO to be pressed when I press the ESC key. I now think i must insist the vbYesNo IS in use.
0
caraf_gCommented:
Sylvania,

I'm afraid the VB message box is a very limited beast. It can only do so much and nothing more.

So the only solution is to write your own. I know this is very disappointing, but that's Micro$oft for you.

I'm not going to answer this question since you quite clearly stated that you did not want to design your own form. But in that case you're faced with an impossibility.

There are other solutions that should be acceptable if you are willing to be a little bit more flexible. For example you could slightly modify EDDYKT's solution:

MsgBox "hi", vbYesNo + vbDefaultButton2

But if the box MUST perform exactly the way you want it to, there is no other option, but to create your own message box. In that case, check out this sample project I wrote for the purpose. All the difficult design work to make the form look exactly like a messagebox has been done for you so you just need to modify it so it behaves as required.

The project can be found in http://homepage.eircom.net/~carafa/VBSamples/VBAll/MessageBox.zip 


Good luck!

Pino
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SylvaniaAuthor Commented:
Thanks Caraf_g... or Pino? :)

That wasn't what I wanted, as we both stated, but there is this conviction in your "voice" that, like a siren's call, force me to accept your comment as an answer, for you have convinced me of what I was suspecting.

Thanks for your source, maybe I'll use it if I feel too lazy to code it myself! ;)

Sylvania
0
caraf_gCommented:
Sylvania,

You're a star!

Your 100 points have just elevated me to the dizzy heights of the "genius" level, by bumping my points up to 100049

I salute you and I thank you.
0
SylvaniaAuthor Commented:
Glad to have participated in the geniusage of you! ;)
0
caraf_gCommented:
;-) PS - caraf_g is short for "Giuseppe Carafa" which is my real name (I have no shame).

Pino is my normal name, which is short for Giuseppino.

Thanks again

Pino
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.