Click to See Complete Forum and Search --> : Formatting a number


RSH
September 4th, 2001, 09:15 AM
I would like to format a numerical total for display in a textBox or Label the way one used to be able to do it in Basic using (Print Using).
As an example the number 1555333. should be shown as 1,555,333. This formatting should apply to any number submitted to the display and therefore cannot hard coded.
Thnx&73 RSH

Cakkie
September 4th, 2001, 09:32 AM
The format function can do this for you. The decimal seperator (in this case comma, but might as well be point) will be looked up in the system settings.

Text1.Text = Format(52557859.4, "##,##0.00") ' 52.557.859,40




Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

RSH
September 4th, 2001, 10:55 AM
Thanks Tom:
Just what I needed but had overlooked in my massive quantity of literature. Works perfectly.

73 RSH

Cimperiali
September 4th, 2001, 10:59 AM
So why you rated Cakkie answer 0-wrong/out of topic??

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater

RSH
September 4th, 2001, 11:02 AM
Inadvertantly neglected to pull down the excellent rating so you came up with the zero.
You can put at least a 1 in front of that.
Sorry for the error.
73 RSH

RSH
September 4th, 2001, 11:08 AM
Cimperiali:
See the answer to your question above. It was a typing error which I am not allowed to reverse.
Sorry 'Bout that.
73 RSH

Cimperiali
September 4th, 2001, 11:11 AM
I've seen "a lot" of zeros, today, so I was a bit nervous. I will take the suggestment once a nasty ones gave me, and take a "chill pil"
;-)
Have a nice day

Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.

The Rater

Cakkie
September 5th, 2001, 02:40 AM
Never mind, doesn't affect my score, I know he appriciates my post, so i get my satisfaction. Besides, I reported the problem to Brad yesterday, he will figure it out.

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

RSH
September 6th, 2001, 08:04 AM
Maybe it would be good if the (Rate it) button didnt become visible until after the selection was made.
73 RSH