Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Putting a decimal in programmatically
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00150068
Message ID:
00150168
Vues:
23
>I came back to post just that very problem I encountered with the solution.
>While your solution solves the tabbing around problem, there is one other problem I was not sure the answer to. What can be done in the situation where the user does in fact enter a decimal point in the textbox while entering in the amount? In that situation, the amount still gets divided by 100. ex: Enter 1500 and get 15.00(good) but enter 15.00 and then you get .15(not good)
>How can the control check to see if the user adds the decimal and if not then it gets added?
>I tried this(but it didn't work):
>this.value=iif(substr(right(str(this.value,12,2),3),1,1)=".",this.value,this.value/100)

Check the syntax to be sure, but roughly:

llDecimal = AT(str(this.value),".") > 0
IF NOT llDecimal
this.value = this.value / 100
ENDIF

(Look at AT particularily. I get that backwards a lot)

-Michelle
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform