Jump to content

InputBox error reading


MHz
 Share

Recommended Posts

$answer = InputBox('Input', 'Enter data')
MsgBox(0, 'Data', $answer)

If @error = 0 Then
   MsgBox(0, '', 'The string returned is valid')

ElseIf @error = 1 Then
   MsgBox(0, '', 'The Cancel button was pushed')

ElseIf @error = 2 Then
   MsgBox(0, '', 'The Timeout time was reached')

ElseIf @error = 3 Then
   MsgBox(0, '', 'The InputBox failed to open')

Else
   MsgBox(0, '', 'I do not now')
EndIf

If I press cancel on the InputBox, I receive @error = 0. Should be @error = 1 ?

Am I checking the error status incorrectly ?

Link to comment
Share on other sites

Dim $answer, $err

$answer = InputBox('Input', 'Enter data')
$err = @error
If $err = 0 then MsgBox(0, '', 'The string returned is valid')
If $err = 1 then MsgBox(0, '', 'The Cancel button was pushed')

This example produces a difference.

Would below be the best non-knuckleheadish method for cancel button pressed?

Dim $answer, $err

$answer = InputBox('Input', 'Enter data')
$err = @error
If $err = 1 then Exit
Link to comment
Share on other sites

$answer = InputBox('Input', 'Enter data')
If @error = 0 Then MsgBox(0, '', 'The string returned is valid')
If @error = 1 Then MsgBox(0, '', 'The Cancel button was pushed')
If @error = 2 Then MsgBox(0, '', 'The Timeout time was reached')
If @error = 3 Then MsgBox(0, '', 'The InputBox failed to open')

Tried this first up but was getting @error = 0 everytime, now is working.

I must have created my own error somewhere in the code? Changed so many times lost track of how I achieved it.

My understanding is back on course. :)

Thanks Valik.

Thanks Larry.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...