Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spliting a csv file problem?

Status
Not open for further replies.

iskool

Programmer
Oct 11, 2006
4
JP
Dear all,

I am struggling to split a csv file using....

If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then

Dim fs As New FileStream(OpenFileDialog1.FileName, FileMode.Open)
Dim sr As New StreamReader(fs)

Dim aryUrls As Array
Dim i As Integer = 0
aryUrls = sr.ReadLine().Split(",")

For i = 0 To UBound(aryUrls)

'processing here(aryUrls)

Next


If I open a text file where I have manually typed value1,Value2,Value3 [no spaces] then the correct result is output.
However, when opening up a csv file it will only process the first record.

All help most appreciated.

Kind regards,
iSkool


 
You need to put a loop around your "sr.ReadLine()" command. You are only calling it once, so it only reads the first line.

--Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top