避免在Datagridview控件中舍入小数 [英] Avoid round off decimals in Datagridview control

查看:94
本文介绍了避免在Datagridview控件中舍入小数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







在Datagridview中,我有一列C,它是A列和B的产物。示例列A值= 8.14列B值= 0.2现在列C值为12.296并且在十进制之后我想显示前两个数字,如12.29而不舍入到12.30。



有没有为Column C设置DefaultCellStyle.format的简单方法。



谢谢,

Prathap。

Hi,


In the Datagridview I have a column "C" which is product of Column "A" and "B". Example Column A Value = 8.14 Column B Value = 0.2 Now the column C value is 12.296 and after decimal I want to show first two numbers like 12.29 without rounding to 12.30.

Is there any simple way of setting the DefaultCellStyle.format for the Column C.

Thanks,
Prathap.

推荐答案

您有三种方法:

搜索在Google上 [ ^ ] ...



阅读这篇文章 [ ^ ]。



或者,阅读< a href =http://social.msdn.microsoft.com/Forums/windows/en-US/95e7e7ef-2e71-412f-abe5-ffbee2c12c18/how-to-format-datagridview-columns-to-numeric-columndefaultcellstyleformat-什么不工作?forum = winformsdatacontrols>这个论坛帖子 [ ^ ]。



问候。
You have three ways to do:
Searching on Google[^]...

Reading this article[^].

Or, reading this forum thread[^].

Regards.


这篇关于避免在Datagridview控件中舍入小数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆