Results 1 to 2 of 2

Thread: Text File into Listbox

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Posts
    10

    Smile

    Hi,

    This has done before (as usual) but I was just wondering if someone could suggest some code.

    I want to read a text file line by line into a listbox, eg, every new line in the textfile is read into another line in the listbox.

    The file is predetermined, so no editing is needed.

    Please help, regards,

    Phil

  2. #2
    Guest
    Use Line Input # statement.

    Code:
    Private Sub Command1_Click()
    
        Open "C:\MyTXT.txt" For Input As #1
        Do While Not EOF(1)
            Line Input #1, strLine$
            List1.AddItem strLine$
        Loop
        Close #1
        
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width