Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-06-14
2
Medium Priority
?
327 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
SystemExpert earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Screencast - Getting to Know the Pipeline
Suggested Courses

610 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