Hi,
Index of ArrayList (dbf) goes from 0 to dbf.Count - 1 so you should set ndx and ndx2 to 0 and your while loop should go until ndx(2) < dbf.Count.
Also to read all the lines from your text file you don't need to use a StreamReader, you can call System.IO.File.ReadAllLines() which returns an array of string that you can use instead of dbf.
Best regards,