Skip to content

How to display number with commas and decimal points?

Rossy D

Asked Jun 4, 2015, 1:16 AM EDT1 answer
Share
LinkedInX
i tried this format, got output as 1,234,567,890.00 but i need in this format 1,23,567

decimal unitPrice = 1234567890.00m;
TextBox1.Text = Convert.ToDecimal(unitPrice).ToString("##,#0.00");

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Manoj Bhoir
    0
    Hi,
     
    C#
    Add using System.Globalization;
    
    Try this code :
    
    decimal unitPrice = 1234567890.00m;
                NumberFormatInfo nfo = new NumberFormatInfo();
                nfo.CurrencyGroupSeparator = ",";
                nfo.CurrencyGroupSizes = new int[] { 3, 2 };
                nfo.CurrencySymbol = "";
    
                TextBox1.Text =unitPrice.ToString("c0", nfo);
     
    You will get  output : 1,23,45,67,890
    0