有朋友说:
"设置字段的displayformat:='#0.00'";可以怎么也找不着displayformat这个属性呀???TNumericField(ADOquery1.FieldByName('hj')).DisplayFormat := '#,##0.00'
可就是出错,说找不着hj这个字段,明明有呀,不可能的呀???到底怎么设置呀??? 另外,displayformat:='#0.00'与 DisplayFormat := '#,##0.00' 有什么区别呀?
谢谢了,等会就结贴了~~~
"设置字段的displayformat:='#0.00'";可以怎么也找不着displayformat这个属性呀???TNumericField(ADOquery1.FieldByName('hj')).DisplayFormat := '#,##0.00'
可就是出错,说找不着hj这个字段,明明有呀,不可能的呀???到底怎么设置呀??? 另外,displayformat:='#0.00'与 DisplayFormat := '#,##0.00' 有什么区别呀?
谢谢了,等会就结贴了~~~
TDateTimeField
TDateTimeField才有displayformat如果有多于4位整数的话,#,##0.00会多个 , 吧
具体见帮助:
# Digit placeholder. If the value being formatted has a digit in the position where the "#" appears in the format string, then that digit is copied to the output string. Otherwise, nothing is stored in that position in the output string.. Decimal point. The first "." character in the format string determines the location of the decimal separator in the formatted value; any additional "." characters are ignored. The actual character used as a the decimal separator in the output string is determined by the DecimalSeparator global variable. The default value of DecimalSeparator is specified in the Number Format of the Regional Settings section in the Windows Control Panel.
TDateTimeField
TDateTimeField才有displayformat真的是这样的呀?
#.00 2.5 -> 2.50
0.## .006 -> 00.01 那个大概就是比如#,##0.00
就是1234.234 -》1234.23
上面打错了
TDateTimeField
TNumericField才有displayformat
TNumericField(ADOQuery1.Fields[0]).DisplayFormat:='#,###,##0.00';
这个没有问题,可是到我现在的程序上就不行了,不行是什么原因,说TNumericField无效出错
不用强制转换