Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The FOR EACH loop
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00494274
Message ID:
00494286
Vues:
16
Hi Bob,

The important elements of the command are Group - which must either be an array or a collection - and Var, which holds a reference to the particular element or member of the array or collection currently being iterated.

To loop through a form's controls, you colud do something like:
for each loControl in thisform.controls
  if type("loControl.Enabled") = "L" and loControl.Enabled
    ** take some action
  endif
endfor
Note that you may need to cater for controls that are contained within other controls on the form, and that some containers don't call their collection of controls controls (e.g. the pagefram control calls them pages.

Cheers,

Andrew
>Can someone, help me understand the for each command, (I think I am reading to much into it)
>
>but what I would like to do is loop though an active form (thisform. ) and check for each field wich is .enabled=.t. or some other flag,
>get a value from the tag field and the value of the field itself, and then put it all together in a sql statment,
>
>help says this .
>
>FOR EACH Var IN Group
> Commands
> [EXIT]
> [LOOP]
>ENDFOR | NEXT [Var]
>
>could the group be something like thisform.enabled.objects ? or something like that. ?
>
>or, is there a better way of reaching the same result. ?
>
>thanks a bunch
>Bob Lee


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform