|
-
Oct 13th, 2000, 12:11 PM
#1
Thread Starter
Lively Member
I am using a input box to ask quantity and saving it for a calculation. But i need to know how, what if the user clicks on cancel, how do I make the program end instead of giving an error message.
temp = msgbox("blah", vbYesNo, "blah2")
if temp = vbYes then
end
end if
this works with msgboxes but not with inputboxes, is there a solution????
-
Oct 13th, 2000, 12:15 PM
#2
Fanatic Member
Code:
Dim TheInput As String
TheInput = Inputbox("Please enter something")
If TheInput = "" Then
Msgbox "You Clicked Cancel."
Else
Msgbox "Thanks for entering something!"
End If
-
Oct 13th, 2000, 05:58 PM
#3
The only problem with that is the user could just click ok without entering a value executing the "Cancel" code.
If you want a more reliable way then download my Dialog Extensions DLL, set a reference to it then use the InputBoxEx() function, i.e.
Code:
Private Sub Command1_Click()
On Error GoTo Canceled
Caption = InputBoxEx("Enter Something", CancelError:=True)
Exit Sub
Canceled:
Caption = "Canceled"
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|