Set reference to Microsoft Scripting Runtime Library in your project and run this code making sure you have some C:\MyFile.txt:
Option Explicit
Public myFSO As New Scripting.FileSystemObject
Private Sub Command1_Click()
Dim f As TextStream
Set f = myFSO.OpenTextFile("c:\MyFile.txt", 1)
Text1.Text = f.ReadAll
Set f = Nothing
End Sub
Private Sub Form_Load()
Dim fso, finput, strFileAsString
Set fso = CreateObject("Scripting.FileSystemObject"
Set finput = fspenTextFile("C:\...\abc.txt"
Do While (finput.AtEndOfStream <> True)
strFileAsString = finput.ReadLine()
List1.AddItem (strFileAsString)
Loop
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.