Formatting a Long

Formatting a Long

am 24.11.2007 21:22:35 von Jim Richards

I am trying to format 4800000000 with just commas and no decimel places.
When I use:

Dim WorldPop As Long
WorldPop = InputBox("Enter a large number")

Label1.Text = WorldPop.ToString("N")

I get this in Label1.Text: 4,800,000,000.00

I think that I need to set the precision to 0 so that I won't get the .00 on
the end but I do not know how to code that. Could someone help me with this
please. Thanks in advance, Jim

Re: Formatting a Long

am 24.11.2007 23:20:04 von Marc Gravell

Try WorldPop.ToString("#,#")

For more info: http://msdn2.microsoft.com/en-us/library/0c899ak8.aspx
For more examples: http://msdn2.microsoft.com/en-us/library/7x5bacwt.aspx