Reputation: 99
I am new to VB.net so excuse me if this is supposed to be a very simple point. I have an excel file of 1 column and has values as below:
1111
2222
3333
4444
When i save it as CSV i get each row on new line without any separator/delimiter.
The difficulty i am facing is that when i loop in the data i only get the first row because obviously i can't seem to identify which delimiter i should use.
How can i import that CSV file and use it's value in a loop or datatable?
Thanks for your time and assistance.
Upvotes: 0
Views: 960
Reputation: 1141
More than likely it is using carriage returns or line feeds to separate the data, which would separate out using something like this
Dim sLines() As String = sFileData.Split(vbCr)
or
Dim sLines() As String = sFileData.Split(vbLf)
or still yet as Andrew suggested.
Dim sLines() as String = File.ReadAllLines(sFilePath)
Upvotes: 1