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!

Looping Through Text Boxes

Status
Not open for further replies.

stanmurphy

Technical User
Oct 14, 2000
89
I'm wondering if there is an easier, 'better' method out there for processing a number of text boxes using VFP 7.0 SP1.

Say you have five text boxes on a form. Each box holds a name. They are Text1 through Text5. Currently I would use:

For countname = 1 to 5
STORE "thisform.text"+ALLTRIM(STR(countname))+".value" TO mNAMEHOLD
SEEK (&mNAMEHOLD)
** CODE
** CODE
** CODE
ENDFOR

 
HI,

If you setup an array, you can handle that more easily..

ThisForm.Text1.ControlSource = laArray(1)ThisForm.Text2.ControlSource = laArray(2)ThisForm.Text3.ControlSource = laArray(3)ThisForm.Text4.ControlSource = laArray(4)ThisForm.Text5.ControlSource = laArray(5)

The above code is at the setup time..

You can provide the vales.. by
i=1
SCAN myTable
laArray(i) = myFieldVale
i=i+1 && caution.. i may exceed the arry defined
ENDSCAN && or some such codes..
ThisForm.Refresh()

Unless we understand your need exactly, the solution may not be correct.

Hope the idea helps you :)
:)






ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top