I am trying to create a NumberFormat that will not use Groups at all.
I would like all numbers to be displayed with NO commas.
Example:
- 1999 instead of 1,999
- 2000000 instead of 2,000,000
- etc...
Unfortunately, I am using a 3rd Party control that is a NumericEditor and it applies a CultureInfo setting on it to show commas. So I need to create a CultureInfo
instance that doesn't use Grouping at all.
I have tried this:
int[] groupSize = {0};
CultureInfo culture = new CultureInfo("en-US");
culture.NumberFormat.NumberGroupSizes = groupSize;
Also...
CultureInfo culture = new CultureInfo("en-US");
culture.NumberFormat.NumberGroupSeparator = String.Empty; // Throws and exception with the 3rd party control
The closest I have gotten is...
CultureInfo culture = new CultureInfo("en-US");
culture.NumberFormat.NumberGroupSeparator = " ";
I don't like this solution at all because instead of a comma its white space and it definitely looks odd.
Any ideas?