Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading a text file

Status
Not open for further replies.

GMcFly

Programmer
Oct 2, 2002
48
NL
Hello everybody.
My program has to read a text file and display the contents in a listbox. Here is the code I'm using:
Code:
    nFileNum = FreeFile

    Open "c:\textfile.txt" For Input As nFileNum
    
    Do While Not EOF(nFileNum)
        Line Input #nFileNum, sNextLine
        list_box.AddItem sNextLine
        list_box.Refresh
    Loop
The problem is that it only shows the first six lines. Does anybody have an idea why?
Thanks for your help.
 
OK, I just found out that there was a comma in my text file. Because of that it thought it was the end of the file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top