Page 1 of 1

Round Number

Posted: Thu Feb 25, 2010 1:08 am
by GoodGuy17
Hello,
Does anyone know how to round a number Vb gave me to a whole? Example:
3.53566611111
to
3
I need help for my temperature converter BETA in the showroom section.
Please help me so I can rule the world :twisted: lol.
~GoodGuy17 :D

Re: Round Number

Posted: Thu Feb 25, 2010 11:11 am
by CodenStuff
Hello,

You can use:
Code: Select all
Decimal.Round("3.53566611111")
That should round it to the closest number cooll;

Re: Round Number

Posted: Thu Feb 25, 2010 1:17 pm
by GoodGuy17
Can I just put that code in a button after the part where it puts the number in the textbox?

Re: Round Number

Posted: Fri Feb 26, 2010 9:12 am
by CodenStuff
Hello,

Not sure what you mean GoodGuy17, you just use it like:
Code: Select all
Textbox1.Text = Decimal.Round("1.33")

Re: Round Number

Posted: Fri Feb 26, 2010 8:42 pm
by Nery
Hmm you can't specify the number of characters you want to round?
Lets assume I want to round this number:
1,33333333...
but with 3 characters, it should round to this:
1,333