Hi,
I was trying to read a comma delimited file and identify each element before the comma as a field. The comma is the separator so that you know you have encounter another field. For example (of the file content):
Name1,Phone Number1,ID number 1
Name2,Phone Number2,ID number 2
Name3,Phone Number3,ID number 3
So I was thinking of using PARSE for this:
Dim aFileinput() As String
Do While iEOF = 0
sInput = FILE_LineInput(FileHandle)
nLines = Parse(sInput,aFileinput(),",")
s1 = aFileinput(1)
s2 = aFileinput(2)
s3 = aFileinput(3)
Console_Write(s1 + $CRLF + s2 + $CRLF + s3 + $CRLF + $CRLF)
iEOF = FILE_EOF (FileHandle)
Loop
When I run it, I see all my input from the file print on the screen but then there is an error message:
400 Subscript out of range in array or matrix
Line 33
Line code s2 = aFileinput(2)
But it did print out aFileinput(2) and (3). I'm thinking that I'm not assessing the array correct to get to the "next field"?
Or is there a better way to do what I am trying to accomplish?
Thanks for your help again. Learning from the experts.
Bookmarks