I'm using vb .net (asp .net) to read the data in a text file. I have no problem listing all of the data, but I need to separate it by the columns it's in. The data is tab delimited in the text file. I know I need to use the split function, but I'm not really used to the StreamRead thing and can't figure it out.
Here is an example of the text file:
1.15 106.0 3.341 0.06
1.20 103.2 2.889 0.05
1.25 76.0 3.592 0.05
1.30 82.7 3.331 0.05
1.35 138.1 3.219 0.05
1.40 84.3 2.656 0.05
.
.
.
It goes on like that for a while. I've tried to load each column int a datagrid also, I couldn't get that to work either.
Here is some of the code I came up with:
Thanks for any helpCode:Dim strArray() As String Dim columnDelimiter As Char Dim strField As String columnDelimiter = "\t" oStreamRead = File.OpenText("C:\cpt\CPT-04.txt") Do oStreamLine = oStreamRead.ReadLine strArray = Split(oStreamLine, columnDelimiter) Response.Write(strArray) Loop Until oStream.ReadLine = ""
Paul




Reply With Quote