InputBox Cancel

J

Joe Delphi

Hi,

How can I detect if the user pressed the OK button or the Cancel
button when I use the InputBox function?

JD
 
D

Dirk Goldgar

How can I detect if the user pressed the OK button or the Cancel
button when I use the InputBox function?

You can't do it reliably. If the user clicked the Cancel button, the
function will return a zero-length string. But if the user clicks okay
when there is nothing entered in the box, you'll also get a zero-length
string back. I'd suggest you use logic that interprets a ZLS return
value as a cancel, regardless of what the user did to send it back to
you.
 
Top