I was wondering if there was a way to read multiple lines of comma delimited text from multiple text files and store them all in the same array without overwriting the data that is already there? I've tried multiple things, nothing seems to be working. So, for example:
Dim reader As TextFieldParser = New TextFieldParser("text1.txt")
reader.TextFieldType = FieldType.Delimited
reader.SetDelimiters(",")
Dim currentrow as string() = reader.ReadFields()
Dim storageArray() as string()
storageArray(0) = currentrow(0)
storageArray(1) = currentrow(1)
currentrow = reader.ReadFields()
storageArray(2) = currentrow(0)
storageArray(3) = currentrow(1)
Dim reader As TextFieldParser = New TextFieldParser("text2.txt")
reader.TextFieldType = FieldType.Delimited
reader.SetDelimiters(",")
currentrow = reader.ReadFields()
storageArray(4) = currentrow(0)
storageArray(4) = currentrow(1)
..... etc., etc.
I keep getting System.NullReferenceException thrown when I try assigning one value of an array into a different array...
I am aware that ReadFields() returns an array, so I've also tried storing each line in a jagged array, which throws the same error.
As an add on thought to this, is there a better way for me to be doing this? I read a lot about reading the whole file into an array and then parsing it, but I still seem to be having trouble storing a value of one array in another...
Thank you all in advance for the help!