views:

188

answers:

2

Hi, 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.

+2  A: 

This may help :

dataGridView1.Columns["NumericColumn"].DefaultCellStyle.Format = "d";

How to: Format Data in the Windows Forms DataGridView Control

Standard Numeric Format Strings

Canavar
+4  A: 

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.

liggett78