I am trying to read a text file into a text box. When the file is displayed, all data is on one line. How do I get the next line of data to go to the next line?
Example:
employees.ini
Lastname1, FirstName1
Lastname2, FirstName2
Lastname3, FirstName3
The output is:
Lastname1, Firstname1Lastname2, FirstName2Lastname3, FirstName3
my code:
Private Sub Form_Load()
Dim nFileNum As String
' Get a free file number
nFileNum = FreeFile
' Open Employees.ini
Open App.path & "\employees.ini" For Input As nFileNum
' Read the contents of the file into TextBox1
Textbox1.Text = Input(LOF(nFileNum), nFileNum)
Do While Not EOF(nFileNum) ' Loop until end of file.
Line Input #FreeFile, nFileNum ' Read line into variable.
Loop
' Close the file
Close nFileNum
End Sub
Any help would be greatly appreciated!
Example:
employees.ini
Lastname1, FirstName1
Lastname2, FirstName2
Lastname3, FirstName3
The output is:
Lastname1, Firstname1Lastname2, FirstName2Lastname3, FirstName3
my code:
Private Sub Form_Load()
Dim nFileNum As String
' Get a free file number
nFileNum = FreeFile
' Open Employees.ini
Open App.path & "\employees.ini" For Input As nFileNum
' Read the contents of the file into TextBox1
Textbox1.Text = Input(LOF(nFileNum), nFileNum)
Do While Not EOF(nFileNum) ' Loop until end of file.
Line Input #FreeFile, nFileNum ' Read line into variable.
Loop
' Close the file
Close nFileNum
End Sub
Any help would be greatly appreciated!