如何更改datagridview列中的格式 [英] how to change format in datagridview column
本文介绍了如何更改datagridview列中的格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在名称数量"列中输入了一个数字值(例如1000).在用户输入该值后,我希望将其格式设置为"1000.00".
在此先感谢
Lakhan
i have column Name Amount where I enter a numeric value like 1000. I want to format it like 1000.00 after the user has entered the value.
Thanks in Advance
Lakhan
推荐答案
尝试一下...
try this ...
this.dataGridView1.Columns["YourColumn"].DefaultCellStyle.Format = "{0:F2}";
在Windows窗体DataGridView控件中设置数据格式 [
Format Data in the Windows Forms DataGridView Control[^]
在表单设计器中,单击网格,然后编辑列,选择列,将defaultcellstyle格式属性编辑为N2.
In the forms designer click the grid, then edit columns, select your column, edit the defaultcellstyle format property to N2.
这篇关于如何更改datagridview列中的格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文