0

I know this is simple but need some help in formatting a number in a textbox on Leave event. I am trying the below but I am getting incorrect results.

This is what Im expecting:

100 = 100

1000 = 1,000

10000 = 10,000

10000.25 = 10,000.25

2500000.432 = 2,500,000.432

txtAmount.Text = string.Format(System.Globalization.CultureInfo.GetCultureInfo("id-ID"), "{0:#,##0.##}", double.Parse(txtAmount.Text));
  • Wouldn't the standard number formatting rules work for you?, E.g., `string.Format("{0:N}", double.Parse(txtAmount.Text))` – DiskJunky Oct 03 '17 at 14:34
  • @DiskJunky Im not really an expert, I found this online :/ – Mark Fenech Oct 03 '17 at 14:35
  • Then I'd suggest having a read through the .NET documentation here; https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings – DiskJunky Oct 03 '17 at 14:37

0 Answers0