Click to See Complete Forum and Search --> : 2 decimal places
Claire
Apr 4th, 2001, 03:21 PM
How do i format a text box to display a number as two decimal places. Eg. number is 45.888888 and i want it displayed in the text box as 45.89
Thanks
Samantha
kedaman
Apr 4th, 2001, 03:26 PM
Text1.text = cstr(int(45.888888 *100)/100)
HarryW
Apr 4th, 2001, 06:35 PM
The more elegant way to do stuff like this it is to use the Format() and Round() functions, they are documented in the MSDN.
Active
Apr 4th, 2001, 06:57 PM
Round(45.888888,2)
kedaman
Apr 5th, 2001, 05:22 AM
I like the faster inline solution :p
plenderj
Apr 5th, 2001, 11:27 AM
Originally posted by Claire
How do i format a text box to display a number as two decimal places. Eg. number is 45.888888 and i want it displayed in the text box as 45.89
Thanks
Samantha
Clair, If your username is clair, why did you sign the post with the name Samantha ?
Just wondering :)
da_silvy
Apr 7th, 2001, 11:24 PM
Originally posted by Active
Round(45.888888,2)
I can remember exactly what it was, but I am pretty sure there is a bug in the rounding function? :confused:
kedaman
Apr 8th, 2001, 08:21 AM
yeah i think i remember that too, btw, can you do something about your very long sig ?
Claire
Apr 8th, 2001, 01:30 PM
Hi Plenderj
My friend Samantha was here with me at the time and she posted that question!
Claire.
parksie
Apr 8th, 2001, 01:32 PM
I think Round will actually round it, whereas converting to an Integer through multiplying it by 100 will truncate it instead.
kedaman
Apr 8th, 2001, 02:10 PM
my mistake, should be
cstr(int(45.888888 *100+0.5)/100)
da_silvy
Apr 11th, 2001, 02:26 AM
Originally posted by kedaman
yeah i think i remember that too, btw, can you do something about your very long sig ?
Sorry for the trouble :p
All gone now ;)
plenderj
Apr 11th, 2001, 02:28 AM
parksie ; love the avatar ;)
parksie
Apr 11th, 2001, 02:29 AM
:D:p:D
:parksie:
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.