DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I stop a dialog editbox from giving an error when all numbers are removed

When using an editbox in a SUD the box initialises with a variable. Then I would like to change the value in the editbox which works ok unless the editbox is cleared completely, then an error occurs because the R variable cannot be prescribed as zero.
 
I think that it is just a case of refreshing the contents when I leave the SUD. I press a button.
 
The text looks like this for the editbox.
 
Sub Editbox6_EventInitialise()
Dim This : Set This = Explanation
this.text  
0 Kudos
Message 1 of 3
(3,634 Views)

Sorry, hit post button by accident.

this is the rest of the script.

Sub EditBox6_EventChange()

Dim This : Set This = EditBox6

            R10 = this.text

End Sub

 

Sub EditBox6_EventInitialize()

Dim This : Set This = EditBox6

            this.Text = R10

End Sub

Thanks

Stagsden

0 Kudos
Message 2 of 3
(3,633 Views)
Hi Stagsden,

This is a VBS problem in general. The Type of Rx variables are explicit Double and the Edit.Text is a variant with the sub type string. If you assign something like R1 = edit.Text VBScript tries to convert a string into a double type. That works if the string is a regular numeric string like 12 or 3.13 - but it fails in case of a empty string (""). You can check that in the DIAdem SCRIPT editor like:

Dim t

t = "12"
R1 = t
msgbox R1

and

t = ""
R1 = t
msgbox R1

We have an example  which shows how to handle such stuff and it shows how you can check the entry. Please have a look at "Checking Dialog Box Entries"

Greetings
Walter

0 Kudos
Message 3 of 3
(3,617 Views)