限制DBGrid中的小数位数 [英] Limit Decimal Places in DBGrid

查看:105
本文介绍了限制DBGrid中的小数位数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个连接到ClientDataSet的DBGrid,它有一个字段UnitCost。我想要做的是将每个分配给该字段的值限制为2个小数位。除了验证每个输入值之外,还有其他更简便的方法吗?

I have a DBGrid which is connected to a ClientDataSet and it has a field UnitCost. What I want to do is to limit to 2 decimal places every value that will be assigned to that field. Is there an easier way to do this other than validating every input value?

推荐答案

您可以尝试设置 ClientDataset.FieldByName('UnitCost')。EditMask:='#.00';

这篇关于限制DBGrid中的小数位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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