HighTechTalks DotNet Forums  

Formatting a Long

Dotnet General Discussions microsoft.public.dotnet.general


Discuss Formatting a Long in the Dotnet General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jim Richards
 
Posts: n/a

Default Formatting a Long - 11-24-2007 , 03:22 PM






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



Reply With Quote
  #2  
Old   
Marc Gravell
 
Posts: n/a

Default Re: Formatting a Long - 11-24-2007 , 05:20 PM






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

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.