Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic (http://www.programmingforums.org/forum18.html)
-   -   Input Box And Cancel Button (http://www.programmingforums.org/showthread.php?t=1142)

killiank Nov 14th, 2004 9:34 PM

What is the best way to tell if the user canceled out of an input box instead of OK?

is there an err number returned or do I have to tell by what is in the box? If so, what is the difference of that and if someone pushed the OK button without entering anything in the text field? Aren't they both empty strings returned?

Thanks,

Berto Nov 15th, 2004 4:03 AM

i dont no if its the same here but in java cancel is seen as a null input, just run the program in debuger nad check the variable after a user has clicked canel/.

Pizentios Nov 15th, 2004 9:53 AM

Well since VB is an event driven language, you could use the on-click event handler.

Ooble Nov 15th, 2004 11:35 AM

It's an InputBox - it doesn't have an event handler. It returns an empty string if the user clicks Cancel, but also if the user clicks OK without entering anything. It's up to you to figure out how to handle this.

Berto Nov 15th, 2004 11:46 AM

it returns vbCancel :)

Ooble Nov 15th, 2004 11:53 AM

Really? Damn web site...

Pizentios Nov 15th, 2004 12:30 PM

Quote:

Originally posted by Ooble@Nov 15 2004, 11:35 AM
It's an InputBox - it doesn't have an event handler. It returns an empty string if the user clicks Cancel, but also if the user clicks OK without entering anything. It's up to you to figure out how to handle this.
ooops, miss read the question. Sorry, i though you were talking about a normal button.

Ooble Nov 15th, 2004 12:32 PM

Genius...

I was thinking about this, and then realised it had to be a load of crap - vbCancel's an integer, so the string would equal "2" or something (can't remember exactly what it is).

Pizentios Nov 15th, 2004 12:54 PM

I think it's ether a 0 or 1 to tell you the truth....maybe.

Ooble Nov 15th, 2004 2:20 PM

It's not a 0, and it's a power of 2 - could be a 1 though.


All times are GMT -5. The time now is 1:01 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC