Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why isn't this IIF expression working?
Message
De
19/08/2000 09:43:57
 
 
À
17/08/2000 08:13:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00406009
Message ID:
00407025
Vues:
28
>THISFORM.text18.VALUE=(var1+var2)-THISFORM.text17.VALUE
>
>IIF (THISFORM.text18.VALUE <0,THISFORM.text18.FORECOLOR=RGB(255,0,0) , THISFORM.text18.FORECOLOR=RGB(0,0,0))
>
>I want the font show in red if the value is negative
>

This doesn't do what you want; the result of the IIF() as given retgurns a logical value; if text18.value is < 0, it evaluates whether text18.forecolor is presently set to RGB(255,0,0), and otherwise, it evaluates if text18.forecolor is presently set to RGB(0,0,0); what you want to do is have the IIF assign a new value to text18.ForeColor based on its value:

WITH thisform.text18
   .forecolor = iif(.value RGB(255,0,0), RGB(0,0,0))
ENDWITH


You assign the value of a function to a variable, field or property (in this case, you want to assign a new value to the forecolor property); the problem is that the function evaluates the argument, and since it's legal to test a property against the return from a function of the same type, you aren't getting an error - it seems to not be doing anything.

>Thanks in advance
>
>Ulises
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform