Filling fields with

Say you have a number of fields which, for simplicity, we call fld1, fld2, …fldn (where n is a number).
Is there a way, using a for…next cycle, to call those fields by having the loop change the final number of the field in sequence?

Something like:

For i as Integer=1 to n
do something to fldi

Try something like this:

for currentControl as Integer = 0 to theWindow.ControlCount - 1 dim theControl as RectControl = RectControl(theWindow.Control(currentControl)) if theControl isA TextArea then 'do something here with your control end if next

you can use this method :

[code]Public Function GetControlByName(aWindow as window, aName as String) as RectControl
dim ctrl as RectControl

if aWindow<>nil then
For i as Integer=0 To aWindow.ControlCount-1
if aWindow.control(i) isa rectcontrol then
ctrl=RectControl( aWindow.control(i))
if ctrl<>nil then
If ctrl.Name=aName Then
return ctrl
End If
end if
end if
end if

return nil

End Function

then call the method with field+str(i) and get your controlitem back
cast it to a textfield and use it the way you want.

Can you make the textfields a control array? That might simplify your code.

Yes, try Control Sets. Here’s the User Guide topic: