You could also look at using a TObjectList instead of an array to hold the
stringlists.
It has the added advantage of freeing the objects when the list item is
deleted.
>From D5 help:
TObjectList maintains a list of (owned) objects.
Unit
contnrs
Description
Use a TObjectList to store and maintain a list of objects. TObjectList
provides properties and methods to add, delete, rearrange, locate, access,
and sort objects. If the OwnsObjects property is set to True (the default),
TObjectList controls the memory of its objects, freeing an object when its
index is reassigned; when it is removed from the list with the Delete,
Remove, or Clear method; or when the TObjectList instance is itself
destroyed.
HTH
Steve
> -----Original Message-----
> From: Reginald Ebenezer [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 6 July 2001 00:09
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: array of TStringList
>
>
> Hi
> It should be like this
> var
> Categories : array of TStringList;
> begin
> Setlength(Categories,1)
> Categories[0] := TStringList.Create;
> end;
> First of all u need to set the length of the array and then create the
> stringlist
> Regds
> Ebenezer
> ----- Original Message -----
> From: "Ross Levis" <[EMAIL PROTECTED]>
> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> Sent: Thursday, July 05, 2001 03:25 PM
> Subject: [DUG]: array of TStringList
>
>
> > I was hoping the following would work but it appears not.
> It compiles
> > OK but produces memory errors at runtime. Why doesn't the compiler
> > complain if TSringList can't be used in an array?
> >
> > var
> > Categories : array of TStringList;
> > begin
> > Categories[0] := TStringList.Create;
> > end;
> >
> > Cheers,
> > Ross.
> >
> >
> --------------------------------------------------------------
> ------------
> -
> > New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
>
> --------------------------------------------------------------
> -------------
> New Zealand Delphi Users group - Delphi List -
> [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"