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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Import text file to listbox

Status
Not open for further replies.

yeungsprite

Programmer
Nov 28, 2002
25
US
I am wondering if there is a simple way to import a text file of words (one per line) into a listbox, besides using the 'AddItem' method.

Thanks

 
Private Sub cmdLoad_Click()
Dim fnum As Integer
Dim file_line As String

lstLines.Clear

fnum = FreeFile
Open txtFile.Text For Input As fnum
Do While Not EOF(fnum)
Line Input #fnum, file_line
lstLines.AddItem file_line
Loop
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top