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");
How to display number with commas and decimal points?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Manoj BhoirRank #599 · 4K pointsPosted Jun 4, 2015, 1:56 AM EDT
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);