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?
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
[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
next
end if
return nil
End Function
[/code]
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.