Window.ControlCount
From Xojo Documentation
Read-Only Property (As Integer )
The number of controls in the window.
Example
The following example is in the Action event of a PushButton. It displays the number of controls in the Window:
MsgBox(Self.ControlCount.ToString)