datagridview格式值-winform [英] datagridview format value - winform
本文介绍了datagridview格式值-winform的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DataGridView dgv
是从数据表填充的.
dgv
中的一列称为cashValue
,我希望它具有数千个分隔符.因此,在dgv
中的数据填充期间,我有以下代码:
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:
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
推荐答案
尝试使用:
dgv.Columns["CashValue"].DefaultCellStyle.Format = "N2";
对OP评论的回应:
也许您可以更好地看看格式设置类型 [
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.
这篇关于datagridview格式值-winform的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文