02-21-2019 07:33 PM
I have a dialog box with few edit boxes (Default value is set to 0) to get numeric values from the user.
After validating the data entered, if there is an error, I pop up a message box.
I need a working code to close the dialog box and clear the edit box details and relaunch the dialog box.
Currently the code snippet I am using is relaunching the dialog box, but the edit box texts are retaining some value (Other than the default value expected)
Solved! Go to Solution.
02-22-2019 08:54 AM - edited 02-22-2019 08:57 AM
I created 3 edit boxes and called them E1, E2, E3. Their default values are "default 1", "default 2", "default 3". Also a button "Button1"
'-------------------------------------------------------------------------------
Option Explicit 'Forces the explicit declaration of all the variables in a script.
'Note: In this area area you can program auxiliary variables and functions that you can use in the entire dialog box.
Sub Button1_EventClick(ByRef This) 'Created Event Handler
If E1.Text = "1" Or E2.Text = "1" Or E2.Text = "1" Then
Call MsgBox("Error... Restoring values")
Call Dialog.RunInitialize()
Else
Call MsgBox("Good Job")
End If
End Sub
DIM E1_TEXT, E2_TEXT, E3_TEXT
E1_TEXT = "default 1"
E2_TEXT = "default 2"
E3_TEXT = "default 3"
Sub Dialog_EventInitialize(ByRef This) 'Created Event Handler
E1.Text = E1_TEXT
E2.Text = E2_TEXT
E3.Text = E3_TEXT
End Sub
If you click the button and any of the edit boxes have the text "1" (error state), the dialog box will reinitialize.