DIAdem Help

Method: Item for Controls

  • Updated2024-09-12
  • 2 minute(s) read

Method: Item for Controls

Returns the control for a specific index in user dialog boxes. The returned object enables you to access the entries in the collection.

Set oControl = Object.Item(NameOrIndex)
ObjectControls
Object with this method
NameOrIndexVariant
Specifies the name or the index of the specific control.
oControlControl
Returned control
Note  You can always omit the Item property because it is the standard element of the collection.

The following example specifies the text color for the MyButton button in the dialog box. The second line of the example is the simplified form of the first line:

Dialog.Controls.Item("MyButton").ForeColor = vbBlue
Dialog.Controls("MyButton").ForeColor = vbBlue

The following example specifies the text color of the first control in the Page1 tab. The second line of the example is the simplified form of the first line:

Page1.Controls.Item(1).ForeColor = vbBlue
Page1.Controls(1).ForeColor = vbBlue

The following example checks the controls of the Dialog dialog box and sets the width of the existing textboxes to 100:

For i = 1 To Dialog.Controls.Count
  If Dialog.Controls(i).ObjectType = "EditBox" Then
    Dialog.Controls(i).Width = 100
  End If 
Next