To get the number of array indexes use the High function expl. High(StrArray)
"Chris @ IT" <[EMAIL PROTECTED]> wrote: Try length(StrArray) Chris Albert, Innovative Technologies. http://www.it.co.ke/beta -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Nesler, Thomas J Sent: Monday, August 08, 2005 7:15 PM To: [email protected] Subject: [delphi-en] Getting a Dynamic arrays length Hello! I am using Delphi 5. I need to work with Dynamic arrays. Reading in the help file it says that: 'Once a Dynamic array has been allocated, you can pass it to the standard functions Length, High and Low. Length returns the number of elements in the array, ...' I can't seem to get this to work. When I try to compile I get this error: '[Error] Unit1.pas(34): Record, object or class type required' Here is some sample code I used to try to figure out how to work with dynamic arrays: procedure TForm1.Button1Click(Sender: TObject); Var StrArray : Array of String; I :integer; begin SetLength(StrArray,20); For I := 0 to 19 do Strarray[I]:= IntToStr(I) + 'Data'; label1.Caption := IntToStr(Strarray.length); <-----Error here end; ************ End of code ***************** What am I doing wrong? I realize this code is contrived but I should be able to derive what the size of an array is via this method, right? Thanks in advance! Tom Nesler Live long!... Code Well!... and Prosper!... V [Non-text portions of this message have been removed] ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] --------------------------------- YAHOO! GROUPS LINKS Visit your group "delphi-en" on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. --------------------------------- --------------------------------- Start your day with Yahoo! - make it your home page [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> <font face=arial size=-1><a href="http://us.ard.yahoo.com/SIG=12hlc8nn7/M=362329.6886308.7839368.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123536814/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992 ">Fair play? Video games influencing politics. Click and talk back!</a>.</font> --------------------------------------------------------------------~-> ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

