Al. you need to do SetLength since your array is dynamic. So, SetLength(DirMonArray, High(DirMonArray)+1) DirMonArray[High(DirMonArray) - 1].Create(self);
notice I have replace the DminCount with "High(DirMonArray)" as then you dont have to maintain any global variables. Jeremy -----Original Message----- From: Alistair George <[EMAIL PROTECTED]> To: Multiple recipients of list delphi <[EMAIL PROTECTED]> Date: Mon, 31 Mar 2003 10:50:26 +1200 Subject: [DUG]: Array of components > Hi All having probs creating an array (in Create line): > > DirMonArray: array of TDirMonitor; //can this be an open array - or > must it > have [0..100] for example assigned? > > procedure TMainform.DirMonArrayAdd(WatchDir: string); > var Tval: Integer; > CurrDir: string; > begin > //Irrelevant lines removed > inc(DmonCount, 1); > DirMonArray[DmonCount - 1].Create(self); //<<= creation error here > end; > > > > > Help?? > > ----------------------------------------------------------------------- > ---- > 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" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- 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" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
