Display format coluna DBGRid
Galera eu tenho um DBGrid e tenho uma coluna Unidade e uma Qtde, eu estou precisando alterar o display format da coluna Qtde, quando a Unidade for Kg a Qtde fique 0,000 e quando for Und, ela fique 0,0
Sidney Abreu
Curtidas 0
Respostas
Luiz
18/02/2014
No evento OnGetText do seu campo (quantidade) do seu ClientDataSet, você pode fazer isso:
procedure TFrmControle.ClientDataSet1ALU_QUANTIDADEGetText(Sender: TField;
var Text: string; DisplayText: Boolean);
begin
if sender.AsString <> '' Then
begin
if ClientDataSet1ALU_UNIDADE.Text = 'UND' then
text:=FormatFloat('###0.0',sender.AsFloat)
else text:=FormatFloat('###0.000',sender.AsFloat);
end;
end;
GOSTEI 0
Sidney Abreu
18/02/2014
Show de bola, obrigado! abraço!
GOSTEI 0
Luiz
18/02/2014
Magina, precisar estamos ai!
Abraços!
Abraços!
GOSTEI 0