mierlp Posted January 30, 2020 Share Posted January 30, 2020 Hi In VCL you can use this code to format a field. Within uniDBGrid this event is not available Quote procedure TFormMain.DBGridCompareDrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState); begin if Field.Name = 'FIELDNAME' then TFloatField(Field).DisplayFormat := '#,##0.00'; end; Link to comment Share on other sites More sharing options...
M.Ammar Posted January 30, 2020 Share Posted January 30, 2020 this is the same procedure Tfra.UniDBGridRoomDrawColumnCell(Sender: TObject; ACol, ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs); begin if Column.FieldName = 'Rate' then TFloatField(Column.Field).DisplayFormat:= '0.00' ; End; but I didn't test it regards Link to comment Share on other sites More sharing options...
mierlp Posted January 30, 2020 Author Share Posted January 30, 2020 Hi You're solution works fine...thanks. I have created in the main table a lookup field for showing a TIME value from a other table. When i created the lookup field and set the type to TIME or STRING then you can't format it with this code. Then i got a exception error. When leaving the code it show the time value but Always in HH:mm:ss I think it's not possiblie to format a lookup field this way. But thanks for the solutions Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now