|
-
Mar 4th, 2006, 03:13 AM
#1
Thread Starter
Member
Decimal "cut off"??
hey!
i got a problem with a decimal...
theres a decimal: 190,2375 (NOT always with theese numbers!)
how can i make it: 190,24 ?????
thankz!
Human beings are a disease, a cancer of this planet, you are a plague, and we are the cure.
-
Mar 4th, 2006, 03:18 AM
#2
Re: Decimal "cut off"??
Well there is Math.Round() for rounding decimals but those are commas.... I don't think there is any built in functions for rounding off values with commas. Did you mean decimals and accidently put commas or vice versa?
-
Mar 4th, 2006, 03:23 AM
#3
Thread Starter
Member
Re: Decimal "cut off"??
thanks for replying!
the problem is that i want only 2 decimals, i mean the numbers after comma...
*,???? to
*,??
round makes 14,683 15....
thanks
Human beings are a disease, a cancer of this planet, you are a plague, and we are the cure.
-
Mar 4th, 2006, 03:57 AM
#4
Member
Re: Decimal "cut off"??
Two decimal places:-
label1.text = yourvariablename.tostring("#.00")
It's only easy if you know!
VB.NET2003/1.1
VB2005/2.0
-
Mar 4th, 2006, 04:17 AM
#5
Thread Starter
Member
Re: Decimal "cut off"??
God bless you mrcrash!!!!
THANKS!!!
Human beings are a disease, a cancer of this planet, you are a plague, and we are the cure.
-
Mar 4th, 2006, 11:59 AM
#6
Re: Decimal "cut off"??
The commas wouldn't matter correct?? Its just that the "decimal" value is represented as a comma on his computer setting, so it should still work...
-
Mar 4th, 2006, 07:36 PM
#7
Re: Decimal "cut off"??
To aggregate the solutions provided so far, if you want the result to be a Decimal then use Math.Round. If you want the result to be a String then use ToString, although I'd go with "n2" as the parameter. Same result, just using a standard format string instead of a custom one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|