Problem when looping through objects

edited September 2010 in FastReport 4.0
Hi,

I have that code in a DLL to loop through controls
and doing some processes :
Procedure SetFormatReport (Report:TfrxReport);
var
  l: TList;
  i: Integer;
  c: TfrxComponent;
  FormatQuantity,FormatCurrency:String;

begin

FormatQuantity:='%2.'+IntToStr(DecimalCurrency)+'n';
FormatCurrency:='%2.'+IntToStr(DecimalQuantity)+'n';

  l := Report.AllObjects;
  for i := 0 to l.Count - 1 do
  begin
    c := l[i];
    if c is TfrxMemoView then
    if TfrxMemoView?©.TagStr='CURRENCY'  Then
       TfrxMemoView?©.DisplayFormat.FormatStr:=FormatCurrency;
    if TfrxMemoView?©.TagStr='QUANTITY'  Then
      TfrxMemoView?©.DisplayFormat.FormatStr:=FormatQuantity;
  end;
 End;
The procedure is called from the OnBeforePrint event
of TrfxReport :
SetFormatReport (frxReport1);


and the report is loaded in a button (button1) :
frxReport1.ShowReport();

The first time the preview is good and when
i close the preview window and load it again
i get an ""access violation at adress ......... in
filename.dll "" and the page is blank i tried to
debug the procedure and it seems that it is
called more than one time and it stop at the line :
TfrxMemoView?©.DisplayFormat.FormatStr

If someone has an idea ?
Thanks in advance

Leave a Comment