- Oct 17, 2003
- 212
- 0
- 0
Ok I have a CSV .txt file that looks like this:
Moore,Jim,(111)111-1111
Hathoway,Lawerence,(222)222-2222
DeAntonio,Chris,(333)-333-3333
I read each line of the file and want to store the names in an array called memberData and the phone #'s in an array called phoneData. To my exhausation I can not get this to work, below is what I have so far:
If IO.File.Exists(fileName) Then
sr = IO.File.OpenText(fileName)
Else
Message = "Either no file has yet been created or the file "
Message &= fileName & " is not where expected."
MsgBox(Message, , "File Not Found")
End If
Do While (sr.Peek() <> -1)
line = sr.ReadLine
memberData = line.Split(","c)
phoneData = line.Split(","c)
For i = 0 To memberData.GetUpperBound(0)
lstNames.Items.Add(memberData(i))
Next
Loop
sr.Close()
Moore,Jim,(111)111-1111
Hathoway,Lawerence,(222)222-2222
DeAntonio,Chris,(333)-333-3333
I read each line of the file and want to store the names in an array called memberData and the phone #'s in an array called phoneData. To my exhausation I can not get this to work, below is what I have so far:
If IO.File.Exists(fileName) Then
sr = IO.File.OpenText(fileName)
Else
Message = "Either no file has yet been created or the file "
Message &= fileName & " is not where expected."
MsgBox(Message, , "File Not Found")
End If
Do While (sr.Peek() <> -1)
line = sr.ReadLine
memberData = line.Split(","c)
phoneData = line.Split(","c)
For i = 0 To memberData.GetUpperBound(0)
lstNames.Items.Add(memberData(i))
Next
Loop
sr.Close()