DlgValue (statement)

Syntax

DlgValue {ControlName$ | ControlIndex},Value

Description

Changes the value of the given control.

Comments

The value of any given control is an Integer and depends on its type, according to the following table:

 

Control Type

Description of Value

 

Option group

The index of the new selected option button within the group (0 is the first option button, 1 is the second, and so on).

 

List box

The index of the new selected item.

 

Drop list box

The index of the new selected item.

 

Check box

1 if the check box is to be checked; 0 if the check is to be removed.

 

A runtime error is generated if DlgValue is used with controls other than those listed in the above table.

 

The ControlName$ parameter contains the name of the .Identifier parameter associated with a control in the dialog box template. A case-insensitive comparison is used to locate the specific control within the template. Alternatively, by specifying the ControlIndex parameter, a control can be referred to using its index in the dialog box template (0 is the first control in the template, 1 is the second, and so on).

Example

This code fragment toggles the value of a check box.

Sub Main()

  If DlgValue("MyCheckBox") = 1 Then
    DlgValue "MyCheckBox",0
  Else
    DlgValue "MyCheckBox",1
  End If
End Sub

See Also

DlgControlId (function); DlgEnable (function); DlgEnable (statement); DlgFocus (function); DlgFocus (statement); DlgListBoxArray (function); DlgListBoxArray (statement); DlgSetPicture (statement); DlgText (statement); DlgText$ (function); DlgValue (function); DlgVisible (statement); DlgVisible (function).

More information

D