read from a txt fil to a listbox

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
 
T

Tom van Stiphout

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top