[Lazarus] Problem growing an array

Howard Page-Clark hdpc at talktalk.net
Fri Jan 25 20:04:21 CET 2013


On 25/1/13 6:38, appjaws wrote:
> On 25/01/13 18:26, Howard Page-Clark wrote:
>> On 25/1/13 3:55, appjaws wrote:
>>> Hi,
>>> Could one of you experts look at my code please.
>>> My program crashes after the first set of strings are added because -- I
>>> think -- the length is not updating.

You're not initialising the array of array correctly. Try this:

if Length(collection) < (y+1)then
        begin
        SetLength(collection, y+1);
        SetLength(information[0],y+1);
        SetLength(information[1],y+1);
        SetLength(information[2],y+1);
        SetLength(information[3],y+1);
        SetLength(information[4],y+1);
        SetLength(information[5],y+1);
        SetLength(information[6],y+1);
        SetLength(information[7],y+1);
        end;





More information about the Lazarus mailing list