read from a txt fil to a listbox

  • Thread starter Thread starter alvin Kuiper
  • Start date Start date
A

alvin Kuiper

Hi
What is wrong here:
Private Sub cmd_her_Click()
txtinfo.SetFocus
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile("h:\\mine databaser\tekst.txt")
Do
'txtinfo.Value = (a.readline) & vbNewLine
Liste5.AddItem a.readline
Loop While Not a.readline = ""
a.Close
End Sub
I only get the first line
and then eror : input past end of file
 
On Sun, 10 Jan 2010 23:01:01 -0800, alvin Kuiper

Well, for one thing you are reading two lines before testing if you're
at the end. What if the file has zero or one line of text?

-Tom.
Microsoft Access MVP
 
Back
Top