Syntax
DlgValue Identifier[$], Value
DlgValue(Identifier[$])
Remarks
The DlgValue statement is used in a dialog function to select or clear a dialog
box control by setting the numeric value associated with the control specified by Identifier[$]. For example, DlgValue "MyCheckBox", 1 selects a check box, DlgValue "MyCheckBox", 0 clears a check box, and DlgValue "MyCheckBox", -1 fills the check box with gray. An error occurs if Identifier[$] specifies a dialog box control such as a text box or an option button that cannot be set with a numeric value.
For information about using a dialog function, see Chapter 5, "Working with Custom Dialog Boxes," in Part 1, "Learning WordBasic."
Argument | Explanation | |
Identifier[$] | The string or numeric identifier of the dialog box control. The DlgValue statement and DlgValue() function can be used with identifiers created by the following statements: CheckBox, ComboBox, DropListBox, ListBox, and OptionGroup. | |
Value | Numeric value to set the dialog box control identified by Identifier[$] |
The DlgValue() function returns the numeric value of the check box, list box, drop-down list box, combo box, or option group identified by Identifier[$]. For example, DlgValue("MyCheckBox") returns 1 if the check box is selected, 0 (zero) if it is cleared, and –1 if it is filled with gray. The instruction DlgValue("MyListBox") returns 0 (zero) if the first item in the list box is selected, 1 if the second item is selected, and so on.
Example
This example is the portion of a dialog function that runs when the check box with the identifier "MyCheckBox" is selected. DlgValue() is used to determine whether the check box was turned on or off. If it was turned on, the instructions redefine an array and fill a list box with the items in the array.
Case 2 'The user selects a control If identifier$ = "MyCheckBox" Then If DlgValue("MyCheckBox") = 1 Then ReDim MyArray$(1) MyArray$(0) = "Alberto" MyArray$(1) = "Gina" DlgListBoxArray "MyListBox", MyArray$() End If End If
See Also
DlgText