Calculated value in a label
I want to put a calculated value in a Label. I have been able to do this by
assigning the Caption a Value in the Band's BeforePrint event. Is there a
way to assign the Caption in one of the Label's Events? Should I be using a
Variable? I tried using a Variable but don't know what should be on the
left side of the assignment statment...
Just starting out..
assigning the Caption a Value in the Band's BeforePrint event. Is there a
way to assign the Caption in one of the Label's Events? Should I be using a
Variable? I tried using a Variable but don't know what should be on the
left side of the assignment statment...
Just starting out..
This discussion has been closed.
Comments
I tried the following and get a runtime error of '..invalid variant.. The
Variable's data type is 'dtstring'.
procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
begin
value.asString := 'This is a test';
//FItem.Name(tblReport.fieldbyname('item').asString);
end;
You are correct, using the OnCalc event with a TppVariable is much safer
than using a TppLabel. When you place a TppVariable on a report, you can
edit it's datatype by using the combo box in the Designer toolbar. If you
have this set to "String" you should not have to use Value.AsString. Simply
write:
Value := 'I am a String";
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com