CSV Load Problem

wmortensen
08-11-2005, 02:13 AM
I am having problems loading a CSV file into a listbox.
http://ichart.finance.yahoo.com/table.csv?s=ADTN&d=7&e=11&f=2005&g=d&a=7&b=10&c=1994&ignore=.csv

There seems to be an ascii character at the end of each line. It load the who file into one line. I am trying to load one line at a time including the ",". Does anyone know how to get arround this? If I re-save the file in UltraEdit is works fine.

-------------------------------------
Dim tempString As String

Open "C:\Temp\ADTN.csv" For Input As 1


While Not EOF(1)
' note that tempString just holds one line at a time
Line Input #1, tempString
List3.AddItem RTrim(tempString)
Wend
Close 1
-------------------------------------

I would like it to look like this.
10-Aug-05,14.37,14.60,13.36,13.59,417900,13.59
9-Aug-05,16.09,16.09,14.40,14.46,477000,14.46
8-Aug-05,16.62,16.62,15.65,15.82,227100,15.82
5-Aug-05,16.60,16.84,16.20,16.33,206300,16.33


Regards
Warwick

Flyguy
08-11-2005, 02:20 AM
The file is an UNIX text file.
This means that a line does not end with a carriage return/line feed pair, but just with a line feed.
The "Line Input" method can not deal with these files and will read the complete file as a single line.

Have a look at VB File Handling
(http://www.xtremevbtalk.com/showthread.php?t=33238) by ChiefRedBull in the Code Library how to handle this.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum