A TStringlist question ... need help...

From: George (nothingwork_at_genie.it)
Date: 12/17/03


Date: 17 Dec 2003 01:36:21 -0800

Hello to all.

I have a small problem with the "TStringlist"... My application
uses more times the same form (showmodal) that it contains one
tstringlist in the private session of the class (with the
relatives properties Set/Get).

[...]
TFGenForm = class(TForm)
private
  fPassList:TStringList;
  procedure CustomActionClick(Sender:TObject);
pubblic
  property propPassList:TStringList read fPassList write fPassList;
end;
[...]

When I am trying to pass the variable "vPassList" (tstringlist)
from one form to another, like in the following code:

[...]
procedure TFgenform.CustomActionClick(Sender:TObject);
var
  vPassList:TStringlist;
  myform:tfgenform;
begin
  vPassList:=tstringlist.create;
  vPassList.add('item1');
  vPassList.add('item2');
  myform:tfgenform;
  myform:=tfgenform.create(application);
  myform.propPassList:=vPassList;
  myform.showmodal;
  vPassList.Free;
end;
[...]

in the FormShow the elaboration of the tstringlist (propPassList)
comes finished with EAccessViolation...

[...]
templist:=tstringlist.create;
for idx:=0 to propPassList.Count-1
  do templist.add(propPassList.Ststrings[idx]);
[...]

Any idea?
George