Hi all. I'm trying to get words from a csv file and then store them in my program. Like this....
Open the file
Read the first word
Store the word in wordat(1)
Read the second word
Store that word in wordat(2)
Close the file
But I'm getting a "Value of type '1-dimensional array of String' cannot be converted to 'String'." error.
Is the problem the conversion (eg - a string can't be converted to a number) or is it the array (eg - the size of the array is too small)? Or something else? Thanks.Code:thefil = My.Application.Info.DirectoryPath & "\test.txt" Using therea As New Microsoft.VisualBasic.FileIO.TextFieldParser(thefil) therea.TextFieldType = FileIO.FieldType.Delimited therea.SetDelimiters(",") Dim wordat(9) As String x = 0 While Not therea.EndOfData wordat(x) = therea.ReadFields() <<< PROBLEM HERE For Each currentField In wordat(x) MsgBox("wordat " & x + 1 & " " & currentField) x = x + 1 Next End While End Using




Reply With Quote