DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

inputbox

Solved!
Go to solution

Hi,

I am using an inputbox for the user to enter either a 1 or a 0 depending on the option he wants. This works fine.

The problem comes when the user clicks cancel or closes the dialog box, as I am not able to code these options.

 

This is my code:

Dim input

input= Cint(inputbox("Do you want to calculate the offsets (1=Yes, 0=NO)?","Offsets",1))

 

Do while input>1

    input= Cint(inputbox("Please type 1 or 0. Do you want to calculate the offsets (1=Yes, 0=NO)?","Offsets",1))

Loop

 

If input=1 then

............

Else

..........

End if

 

I found the function "Dlgstate" and I thought about using it to check for the cancel or close dialog box options but it didn't work as no matter what I do, the result given by Dlgstate is always the same: "IDcancel"

 

Can anyone tell me what am I doing wrong?

 

Thanks.

Leo

0 Kudos
Message 1 of 3
(6,193 Views)
Solution
Accepted by topic author Leillo

Hello Leillo,

 

There are two different types of functions in DIAdem, those provided by standard VBS and those provided additionally by DIAdem.

 

Inputbox is a VBS function, and does not use the "DlgState" variable, which is only used by DIAdem dialogs.

 

To answer your question, please check the information provided below:

 

The InputBox function displays a dialog box, where the user can write some input and/or click on a button. If the user clicks the OK button or presses ENTER on the keyboard, the InputBox function will return the text in the text box. If the user clicks on the Cancel button, the function will return an empty string ("").

 

It looks like checking for an empty string ("") will get you the desired result.

 

Hope that helps - let me know if you have additional questions,

 

     Otmar

Otmar D. Foehner
0 Kudos
Message 2 of 3
(6,185 Views)

Thanks

0 Kudos
Message 3 of 3
(6,171 Views)