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

vbokcancel

Status
Not open for further replies.

autoIT

IS-IT--Management
May 10, 2006
68
0
0
US
i am attempting to use an inputbox but I cannot get the cancel function to work, how do i code it to actuallt make the input box go away if cancel is selected


Adam
 
How are you coding it now?

Ignorance of certain subjects is a great part of wisdom
 
How are you coding it now?

Ignorance of certain subjects is a great part of wisdom
 
answer=inputbox("Enter A,B, or O")

**I have a do loop that assures something is entered but I need have an "escape plan" by selecting cancel, and have the inputbox go away.

Adam
 
Well, inputbox returns an empty string on Cancel, so that is your problem (I imagien you are keying off of "" to determine whether to show it again or not?)

The way you have things set up now, it is unlikely that you can do anything. Here is what I recommend, you need to give a default value basically. I gave a default value of " " (space) because this will be almost unnoticeable. Consider this example:

Code:
MyStart:
Select Case InputBox("Hello", "What Do You Say?", " ")
    Case "Hello", "Hi", "Howdy"
        MsgBox "How are you?"
    Case " "
        GoTo MyStart
    Case ""
        MsgBox "Forget you then"
End Select

The empty string ("") is returned from cancel, causing a certain behavior. The space (" ") is returned from "OK" with no text entered, causing an entirely different behavior.

Make Sense?

Hope it helps,

Alex





Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top