0
我已经使用下面的答案在我的Visual Basic 2010 DGV中显示小数值。Datagridview中缺少小数值
使用代码可以设置DataGridView.DefaultCellStyle属性。
您还可以通过做到这一点的设计师
1.Right clicking your DGV and select Edit Columns. The Edit Columns dialog appears.
2.Select your column on the left side of the dialog and click the DefaultCellStyle property field to bring up the CellStyle Builder.
3.In the Builder dialog click Format which brings up the Format String Dialog.
4.Make your selections in this dialog (select Numeric type, which allows specifying number of decimals to display) and save your changes.
我的问题是,当我通过一个文本框,绑定到DGV输入新的值,该DGV显示小数位,但不我输入的实际价值。例如:我输入20.25,点击保存按钮。在DGV中,20.25的值表示。只要我关闭程序并再次打开,DGV中的值显示为20.00,而不是20.25。
我该如何解决这个问题?
你如何坚持用户在单元格中输入的值? – 2012-07-17 11:06:24