Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cycling through fields
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00434894
Message ID:
00434897
Views:
20
Hi!

You may try 2 ways:

1. Use controls() or objects() collection of form or container, for example:
for i = 1 to thisform.Controlcount
  z = thisform.Controls(i)
endfor
2. If 'spam' control has common class and you just need to call special code for each control in form for controls of that class, you can easily organize that using Assign method for some junk property. For example:

thisform.SetAll('MyJunkProperty','T') && may be any value assigned

In the MyJunkProperty_Assign method:
lparameters vNewValue
Thisform.MySum = Thisform.MySum + this.Value
...

Above will calculate sum of all values of all controls that contain MyJunkProperty and above assign method for it.

HTH.

>I have 4 fields (actually 15 but I'm keeping it down to 4 for this example). They are name the following:
>
>
>test.spam1
>test.spam2
>test.spam3
>test.spam4
>
>in my for loop I want to cycle through these fields and based on which loop number I arrive at, I need to get information from the correct field.
>
>for a = 1 to 4
> z = test.spam?
>endif
>
>my problem is how do attach the right field number to the end of test.spam? so that I can retrieve correct infomation from field. For example if a = 2 then I want to give 'z' the value of test.spam2. if a = 4 then 'z' should equal the value of test.spam4. Help appreciated.
>
>thank you
>nick patel
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform