tags:

views:

47

answers:

3

Am using An inputbox in my form.

If i Press OK the code is fine. When i Press cancel the Program displayin an error. Wat should i Do ?

+1  A: 

See the documentation for a working sample:

Interaction.InputBox Method

0xA3
+1  A: 

Change the code that is after the InputBox to support empty strings. InputBox will return an empty string if you cancel so the reason for the error must be that your code expects the string to have a lenght > 0.

If you edit the question to show the code that calls InputBox as well as a few lines following that line, someone can probably point out the exact error.

ho1
+2  A: 

You should look for an empty string

    Dim MyString As String

    MyString = InputBox("Please enter something", "Request Info", Nothing)
    If (MyString Is Nothing OrElse MyString = "") Then
        'User hit cancel
    Else
        'Read MyString
    End If
DJIDave