VB Script - Custom Dialog with Textbox and Dropdown

VB Script - Custom Dialog with Textbox and Dropdown

In this case, we want to create a dialog with a drop-down box and input/text box for numerical input. The values from dialog controls are stored in variables var1 & var2, thus allowing math operations, flow control, etc., from the user's response.  

CODE: 

Dim MyList (2)  'Initialize a static array
MyList (0) = "0.000001"
MyList (1) = "0.000005"
MyList (2) = "0.0000001"
'Create dialog object
Set dlg1 = CreateDialog(16,35,256,89,"Part Material and Temperature")
'Add system buttons
dlg1.Add_OKButton 204,24,40,14
dlg1.Add_CancelButton 204,44,40,14
'Declare variables to get the listbox selection
Dim var1, var2
var1 = 20
var2 = 0 'to select first item by default
dlg1.Add_TextBox 24, 24, 72, 12, var1  'Add a Text Box
dlg1.Add_DropListBox 124,24,72,40,mylist,var2  'Add a drop list box
'Add some static text boxes
dlg1.Add_Text 24,12,75,8,"Part Temperature: (C)"
dlg1.Add_Text 124,12,75,8,"Part CTE: (mm/mm/C)"
Button = ShowDialog ( Dlg1 )  'Show dialog
'Verify drop listbox selections
MsgBox("Temperature = " & var1 &vbCRLF & "DropListbox = " & var2)
Set Dlg1 = Nothing  'Destroy the dialog object after use