|
-
Apr 4th, 2001, 03:21 PM
#1
Thread Starter
Junior Member
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
-
Apr 4th, 2001, 03:26 PM
#2
transcendental analytic
Text1.text = cstr(int(45.888888 *100)/100)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 4th, 2001, 06:35 PM
#3
Frenzied Member
The more elegant way to do stuff like this it is to use the Format() and Round() functions, they are documented in the MSDN.
Harry.
"From one thing, know ten thousand things."
-
Apr 4th, 2001, 06:57 PM
#4
Addicted Member
-
Apr 5th, 2001, 05:22 AM
#5
transcendental analytic
I like the faster inline solution
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 5th, 2001, 11:27 AM
#6
Retired VBF Adm1nistrator
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
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Apr 7th, 2001, 11:24 PM
#7
Conquistador
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?
-
Apr 8th, 2001, 08:21 AM
#8
transcendental analytic
yeah i think i remember that too, btw, can you do something about your very long sig ?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 8th, 2001, 01:30 PM
#9
Thread Starter
Junior Member
Hi Plenderj
My friend Samantha was here with me at the time and she posted that question!
Claire.
-
Apr 8th, 2001, 01:32 PM
#10
Monday Morning Lunatic
I think Round will actually round it, whereas converting to an Integer through multiplying it by 100 will truncate it instead.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 8th, 2001, 02:10 PM
#11
transcendental analytic
my mistake, should be
cstr(int(45.888888 *100+0.5)/100)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Apr 11th, 2001, 02:26 AM
#12
Conquistador
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
All gone now
-
Apr 11th, 2001, 02:28 AM
#13
Retired VBF Adm1nistrator
parksie ; love the avatar
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Apr 11th, 2001, 02:29 AM
#14
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|