954,558 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

input box

I have an input box in my program and I want to be able to control the flow when the 'cancel' button is pushed. Any help would be appreciated.

stan yost
Light Poster
29 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
 
retval = inputbox("type stuff")
if retval = "" then 
    ' /* Cancel Pushed, Or Left Blank */
    msgbox "You Entered Nothing..."
else
    ' /* They Typed Stuff */
    msgbox retval
end if
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 
retval = inputbox("type stuff")
if retval = "" then 
    ' /* Cancel Pushed, Or Left Blank */
    msgbox "You Entered Nothing..."
else
    ' /* They Typed Stuff */
    msgbox retval
end if

The message box has two buttons - 'OK' and 'Cancel'. How do I access the flow from the 'Cancel' button. Thanks

stan yost
Light Poster
29 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
 
The message box has two buttons - 'OK' and 'Cancel'. How do I access the flow from the 'Cancel' button. Thanks


Guess I need to be told twice. Thanks!

stan yost
Light Poster
29 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
 

Get the return value from the msgbox call. It returns the button value pressed.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,507 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

In the code I posted, retval (the variable) will be blank if the user pressed cancel. Hence the code:

if retval = "" then 
    ' /* Cancel Pushed, Or Left Blank */
    msgbox "You Entered Nothing..."
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

how can i change inputbox default button, OK and CANCEL to

YES, NO and CANCEL????


cAn yOu hElp mE guyZ.....

lanze12
Newbie Poster
1 post since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You