Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The DataGridView dgv is populated from a data table.
One of the columns in dgv is called cashValue which I would like it to have thousand separators. So during the population of the data in the dgv, I have this code:
C#
dgv.Columns["CashValue"].DefaultCellStyle.Format = "C";

It seems to solve the thousand separator but I do not want the currency sign.
Can I use this style but without the currency sign?

Thanks
Posted
Updated 29-Sep-11 2:24am
v2
Comments
André Kraak 29-Sep-11 8:24am    
Edit question:
Added tags

1 solution

Try using:
C#
dgv.Columns["CashValue"].DefaultCellStyle.Format = "N2";


Response to OP comment:

Perhaps you can better have a look at Formatting Types[^] to see if there is something that best meets your need.
 
Share this answer
 
v2
Comments
arkiboys 29-Sep-11 8:30am    
Is it possible to change the decimal places using N2 format ?
Thanks
arkiboys 29-Sep-11 8:37am    
If I change the format of the cell then the datatable gets updated too and therefore, it shows the records as modified in the datatable. Is there a way so that the datatable does not mark the row as modified?

Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900