Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro changes variable type
Message
De
07/02/2002 11:36:42
 
 
À
07/02/2002 11:24:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00616675
Message ID:
00616683
Vues:
15
Stéphane,

See if declaring i as a LOCAL variable helps.

>Hi,
>
>Here's a piece of code I'm running:
<b>LOCAL i</b>
>FOR i = THISFORMSET.nStart TO THISFORMSET.nEnd
>	FOR lnPosCommands = 1 TO ALEN(THISFORMSET.acCommands)
>		lcCommand = THISFORMSET.acCommands(lnPosCommands)
>		&lcCommand
>	ENDFOR
>	=MESSAGEBOX(VARTYPE(i)) &&<= displays 'C'
>	*i = Val(i)
>ENDFOR
>'acCommands' is an array property of the current FormSet.
>
>Each one of it's entries is a line of text which represents a call to another function using 'i'. Here's an example of one of those calls:
>
>save_FridgLabel(ALLTRIM(STR(i)), 20, 10)
>
>As you can see, the commands were built to use the 'i' variable of my FOR loop. My problem is that after the macro executes, 'i' is no longer of Numeric type but is now a Character (as displayed by the messagebox). Why?
>
>Nowhere in my macro am I setting 'i' (no i = ... and i is not passed as a parameter).
>
>How can I avoid this transformation?
>
>Thanks in advance, Stephane.
Daniel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform