Setting a DBGrid column format in Delphi

时间秒杀一切 提交于 2019-12-01 17:39:27
Germán Estévez -Neftalí-
  1. You can set the DisplayFormat of the Field
  2. You can handle OnGetText event. This approach allows to do more complex operations with the value.

If you don't add the fields to field Editor list you can get the formating by code as :

TFloatField(MyQuery.fieldByName('MyField').DisplayFormat := '0.00';

if you don't want to show the zeros replace '0.00' with '#.##';

The first port of call is the DisplayFormat of the data field in the database itself.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!