Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

msg = inputbox("string")

 

if user press cancel, the program will end, but i dont know how to declare it so that vb able to recognite it??

 

i am appreciated if u guys can help me, thank

Posted

Hi bshaen

 

Odd, that should not happen. Which Event are your calling the InputBox from? If you could post up the whole code for the Event it would help.

Posted
Are you trying to make the program end when the user clicks cancel? Or is it happening and you dont know why?

yeah, if the user click cancel button, its will terminate whole program, and if user jabe yet type any string in the input textbox, it's will promt it again.

Posted
yeah' date=' if the user click cancel button, its will terminate whole program, and if user jabe yet type any string in the input textbox, it's will promt it again.[/quote']If the Cancel button on the InputBox is clicked it returns a Null String. You could check and see if your variable msg (from your first post) is Null or not and code accordingly

 

If msg = "" then

Application.Exti

ElseIf msg <> "" Then

Do While msg <> "string"

msg = InputBox("Try again", "Try again", "Enter something")

Loop

' code to do here if the correct word is entered.

End If

 

With this example, I am not sure if you are trying to get the user to enter some specific Text into the InputBox or not, it would look and see if the returned string was Null (or zero length) and Exit the Application. Otherwise it would check and see if the user enters the right word (string) it will do whatever.

 

I assume that you want it to accept the user input at some point in time or you would end up with a never ending Loop.

 

Hope this helps.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...