Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing field names in a loop
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00111687
Message ID:
00111689
Vues:
10
Gerry,

I don't know if this was a typo in your message, but I don't think you should have two periods before your macro sub. I understand the two periods after (one to terminate the macro, one to seperate the object from its property.

If you use a naming convention for your controls you should be able to do something like this:
FOR nFldCntr = 1 TO ALEN(nFluids)  && max of 14 for now
  cTxtBoxTarget = "txtFLUIDS" + ALLTRIM(STR(nFldCntr))
  cLabelTarget = "lblFLUIDS" + ALLTRIM(STR(nFldCntr))
  THIS.&cFldTarget..CAPTION = "Test for label"
  THIS.&cLabelTarget..VALUE = "Test for textbox"
ENDFOR
I'm not sure if this answers what you're asking, but I hope it helps :)

>VFP Gurus,
>
>I was able to do this fairly easily in FPW, but VFP - as we all know - is a WHOLE new ballgame.
>
>I need to put data in a field based on its position. Rather than use a giant DO CASE... statement to refer to different numbered fieldnames, such as FLUIDS1, FLUIDS2, ... FLUIDS14, I'd like to do it via a DO loop. Something like this:
>
>FOR nFldCntr = 1 TO ALEN(nFluids) && max of 14 for now
> cFldTarget = "FLUIDS" + ALLTRIM(STR(nFldCntr))
> ** here's the fun part...
> THIS..&cFldTarget..CAPTION = "Test for label"
> ** or
> THIS..&cFldTarget..VALUE = "Test for textbox"
>ENDFOR
>
>Any suggestions or solutions?
>
>Thanks! - Gerry
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform