Window.Control

From Xojo Documentation

Method

Window.Control(index As Integer) As Control

Supported for all project types and targets.

The zero-based way to lookup controls in the window.

Notes

All controls on the window are returned as a the Control base type. You can use the IsA operator to check the specific type to see if the control is a PushButton, Label, etc.

Example

This example is in the Action event of a PushButton and displays the name of the first control in Window:

MsgBox(Self.Control(0).Name)

Loop through all the controls on a Window and disable only the TextFields:

Dim c As Control
For i As Integer = 0 To Self.ControlCount - 1
c = Window.Control(i)
If c IsA TextField Then
TextField(c).Enabled = False
End If
Next