Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
NumericUpDown w/ decimals
Message
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 1.1
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01042036
Message ID:
01042061
Vues:
22
>I have a numvericupdown on a form where I allow the use to enter in a decimal value. Except everytime I go to get the value from that control it doesnt hold the decimal value and only takes the integer? Does this control not hold decimals, I found something online that said it truncated it, but I couldnt beleive it!

David,
What is DecimalPlaces set to?

I have DecimalPlaces set to 2 and this code works like a charm (from a button click):
decimal d = this.numericUpDown2.Value;
MessageBox.Show(d.ToString());
I would reccomend using the following code though:
decimal d = Decimal.Round(this.numericUpDown2.Value, (int)this.numericUpDown2.DecimalPlaces);
MessageBox.Show(d.ToString());
Einar
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform