~~Title: Reading Dialog Control Values ~~ The primary use of a script dialog is to obtain information from the user. The **[[:reference:scripting_reference:scripting_objects:control|Control]]** object is used to read data from dialog controls. In a [[.the_dialog_message_loop:detached_dialogs|detached dialog]] you can do this while the dialog is open; in both a simple and a detached dialog you can also do this after the dialog has closed. The **[[:reference:scripting_reference:scripting_objects:dialog|Dialog]].Control** method is used to obtain a **[[:reference:scripting_reference:scripting_objects:control|Control]]** object corresponding to a dialog control. The **[[:reference:scripting_reference:scripting_objects:control|Control]]** method takes between one and three parameters: Dim dlgCtrl Set dlgCtrl = Dialog.Control ( , [, []] )   The **** parameter is the name of the control, as specified in the control’s properties. This parameter is required. The other two parameters are only needed if you have any //Tab controls// on your dialog, as these can host other dialogs. The **** parameter specifies the name of the dialog (as specified in its properties), and optionally the **** parameter specifies the name of the tab. You would only need to provide all three if you had multiple tab controls with the same child dialog used in both (an unlikely scenario). The **[[:reference:scripting_reference:scripting_objects:control|Control]]** object returned can be used to read data from the corresponding dialog control. In a detached dialog this will return the current control value as long as the dialog is open, and also lets you interact with the control (e.g. your script can change the control's value after the dialog has been created). After the user has closed the dialog the **[[:reference:scripting_reference:scripting_objects:control|Control]]** object can be used to obtain the final value of each control. Below is an example of a simple (non-detached) dialog that asks you to enter your name, and then click a button to close it. The name you entered, along with the button you chose, will be displayed in the script output log. {{:media:image135.png?nolink|}} Function OnClick(ByRef clickData) Set Dlg = DOpus.Dlg Dlg.window = clickData.func.sourcetab Dlg.template = "testdlg" Dlg.Show DOpus.Output "Hi, " & Dlg.Control("name").value & "!" DOpus.Output "Return code = " & Dlg.result End Function