i have made a custom class "lln" (student) and i got a file which contains data which should be read to an lln-array: dblln (student-array)
it works but if the file contains 3 students, then the array will contain 3 students which are all the same: the last student.
i really dont see why the 1st student gets replaced by the second when the second is read.
example file:
keith
13 years
male
sophie
16years
female
the data will be read correctly but array will look like this:
sophie (dblln(0).name)
16years (dblln(0).age)
female (dblln(0).sex)
sophie (dblln(1).name)
16years (dblln(1).age)
female (dblln(1).sex
here is the code i use to read the data in dblln (the student-array)
plln is an integer which indicates the position (you will see)
i have also tried it reading it into a list(of T) and then converting it to the array but it gave me the same resultsCode:Dim ifile As System.IO.StreamReader = My.Computer.FileSystem.OpenTextFileReader(_dblln) While (Not ifile.EndOfStream) tlln.hallo(ifile.ReadLine, ifile.ReadLine, ifile.ReadLine, ifile.ReadLine, ifile.ReadLine) ReDim Preserve dblln(plln) dblln(plln) = tlln plln += 1 End While ifile.Close()![]()




Reply With Quote
