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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.