Read / Load contents of a textfile into a listbox
Reads / Loads contents of a textfile into a listbox
Inputs
filepath+filename and listbox name
Returns
returns contents of a textfile into a listbox
API Declarations
usage:
File2ListBox "c:\yourfile.txt", ListBox1
Rate Read / Load contents of a textfile into a listbox
(6(6 Vote))
Public Sub File2ListBox(sFile As String, oList As ListBox)
Dim fnum As Integer
Dim sTemp As String
fnum = FreeFile()
oList.Clear
Open sFile For Input As fnum
While Not EOF(fnum)
Line Input #fnum, sTemp
oList.AddItem sTemp
Wend
Close fnum
End Sub
Read / Load contents of a textfile into a listbox Comments
No comments yet — be the first to post one!
Post a Comment