Dim objReader As New System.IO.StreamReader("c:\test.txt")
Dim fields() As String
Dim line As String
Do
line = objReader.ReadLine
If Not line Is Nothing Then
fields = line.Split("|"c)
For i As Integer = 0 To fields.Length - 1
MsgBox(fields(i))
Next
End If
Loop Until line Is Nothing
objReader.Close()
hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)
"roy_ware" <ro*****@discussions.microsoft.com> schreef in bericht
news:48**********************************@microsof t.com...
I am reading 4 variable length fields from a text file via StreamReader -
a truly slick tool - but was wondering what was the best way to seperate the
read record into its 4 fields.
I've modifed the file layout to use pipes instead of commas for the field
delimiters, but I hope there is a better method than moving the record to
an array and working it over character by character. I mean, if I have to, I
can do it, but is just seems so archiac - kind of like the Assembler I
first learned to program 30 years ago!