Reputation: 18790
I have a DataGridView
and I am writing integers in to one of the columns, I would like these values not to have a comma in them when the value >= 1000. But at the moment, when i enter a value which is >= 1000 they appear in the form '1,000', the comma could be translated incorrectly in certain areas so I would prefer it to just appear as '1000'. Is there any formatting of the DataGridViewColumn
that will stop this.
Upvotes: 1
Views: 1829
Reputation: 48088
This may help :
dataGridView1.Columns["NumericColumn"].DefaultCellStyle.Format = "d";
How to: Format Data in the Windows Forms DataGridView Control
Standard Numeric Format Strings
Upvotes: 2
Reputation: 11358
the comma could be translated incorrectly in certain areas
If you mean "certain countries/locales" by that then this is incorrect. Your numbers are being formatted according to the rules of the current user's locale, so a comma in one locale would become a dot in other etc. Other than that specify "D" or "d" as DataFormatString to format it without any punctuation.
Upvotes: 4