Solved

Display a number with both comma seperators and NO decimal places?

Posted on 2006-06-14
2
318 Views
Last Modified: 2010-04-16
C# application.

Hi,

I've a double such as '34567', and I need to display this as label text as '34,567'.  Note that I do not want to display any decimal places.

I have managed to get the comma delimiters inserted by using:

NumberFormatInfo nfi = new CultureInfo( "en-US", true ).NumberFormat;
double GIA = 34567;
Label10.Text = GIA.ToString("N", nfi);

result = 34,567.00 <--NOTE that the result includes decimal places!

So the question once more is, how can I get both the comma delimiters AND no decimal places?

Thanks for your help.
0
Comment
Question by:NAORC
2 Comments
 
LVL 10

Accepted Solution

by:
SystemExpert earned 500 total points
ID: 16901091
Hi,

Label10.Text = GIA.ToString("0,00");

Thanks
0
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16901216
Hi,
The exact code with globalization is

double GIA = 34567;
NumberFormatInfo nfi = new CultureInfo( "en-US", true ).NumberFormat;
Response.Write(GIA.ToString("0,00", nfi));

Regards
Pradeep
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now