Count total control in window project

hi
i have window form in my project Which compound many controls . Then I want loop to learn count control in my window form
im use
dim ctl as control
For Each ctl in frmWrtColono.Control
Next
but error

thank
sorry I don’t speak English very well.

how about

me.controlcount

dim i as integer
dim crtl as control
for i=0 to window.controlcount-1
ctrl=window.control(i)

next

thank Jim mckay
I’m attempt get value from control excam “ctrl.text” for textfield control but error

You’ll want the isa operator and typecasting

if ctrl isa textfield then
thetext=textfield(ctrl).text
end if

see the language reference for more info
http://documentation.xojo.com/index.php/IsA