08-19-2013 09:25 AM
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
Solved! Go to Solution.
08-19-2013 11:57 AM
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
08-20-2013 05:45 AM
Thanks