Solved

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

Posted on 2006-06-14
2
319 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get String split 5 46
Create XML 5 46
MVC5 Dataformat String for Phone not working 3 25
C# Json POSt to Rest API 4 32
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

9 Experts available now in Live!

Get 1:1 Help Now