Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

a format question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ned White - 16 Mar 2008 12:37 GMT
Hi All,

when i use "{0:#,#.##}" format string for decimal values it seems like that;
12,1457  --> 12,15
45,4119 --> 45,41

but for one decimal digit values it does not show zero after first decimal
digit.
12,4000 --> 12,4
78,8000 --> 78,8
45,5000 --> 45,5

are there any format string to show zero after decimal digit like that;
12,4000  --> 12,40
78,8000  --> 78,80
45,5000 --> 45,50

Thanks ..

White..
Martin Honnen - 16 Mar 2008 13:35 GMT
> Hi All,
>
[quoted text clipped - 12 lines]
> 78,8000  --> 78,80
> 45,5000 --> 45,50

I think you want
  "{0:#,##0.00}"

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

Jon Skeet [C# MVP] - 16 Mar 2008 16:27 GMT
> Hi All,
>
[quoted text clipped - 12 lines]
> 78,8000  --> 78,80
> 45,5000 --> 45,50

Use "{0:#,0.00}" - look at the docs for the difference between 0 and #
in a format string.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.