Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Negative Numbers shown without a - minus
Message
De
29/08/2014 14:25:16
 
 
À
29/08/2014 13:08:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01606633
Message ID:
01606730
Vues:
57
>>>I would create a custom class of the textbox. Then add an Assign method to the Value property with the following:
>>>
>>>
>>>LPARAMETERS txValue
>>>this.ForeColor = RGB(0,0,0)
>>>IF VARTYPE(txValue) = "N"
>>>  IF txValue >= 0.00
>>>    this.Value = txValue
>>>  ELSE
>>>    this.Value = "(" + ABS(txValue) + ")"
>>>    this.ForeColor = RGB(255,0,0)
>>>  ENDIF
>>>ELSE
>>>  this.Value = txValue
>>>ENDIF
>>>
>>
>>If the user changed her mind and decided to make the number positive, how would the forecolor change back?
>>
>>That forecolor might stay red if the user
>
>Did you read the code carefully? (Hint: see line # 2)

Hrm... When value is negative, the value property is changed to a character value and the color is changed to red. What happens when user goes back to the field to re-enter a new value? Is the value property switched back to numeric, or does it remain character?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform