Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can controls on a form be indexed?

Status
Not open for further replies.

baileybelle

Technical User
Jul 22, 2002
10
US
I was wondering if it was posible to have a control array in VFP similar to the way it can be done in VB. For example, I would like to loop through certain text boxes and populate table field values doing something like this:

With ThisForm
For i = 1 to Recount()
.textbox(i).value = FieldValue
.textbox(i).value = FieldValue
....etc....
Next
EndWith

Can this be done? If not, what would be an alternative. Thanks in advance..Everyone here is so helpful and knowledgeable. This forum is great!!

 
HI

If the textbox values relate to one record, all you have to do is to set the control source to the fields. SO as the records are skiped, the values change automaticaly.

However, if you are thinking of multiple records in a single form.. then.. grid is the best answer.

In neither case, the controls indx is not required.

However you can have the objects collection in a form using the controls property and then looping thru that.. as shown in this example.

FOR EACH oThis IN ThisForm.Controls
WAIT WINDOW oThis.Name
ENDFOR

:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top