How does bob.txt look like? If you're reading a string, you need to have it between quotes. Otherwise use "Line Input", binary, or the FileSystem object.
You could use this code as well. Put this in a module:
Code:
Public Sub TextToList(WhatList As ListBox, TextFile$)
Rem Makes a .txt file from a listbox
On Error GoTo FartK
Dim X%
X% = FreeFile
Open TextFile$ For Input As #X
While Not EOF(X)
Input #X, sText$
DoEvents
WhatList.AddItem sText$
Wend
Close #X
Exit Sub
FartK:
Exit Sub
End Sub
Then on your forum have 2 command buttons and 1 listbox. All default names.
In Command1 have:
Code:
Private Sub Command1_Click()
TextToList List1, "C:\pos\bob\bob.txt"
End Sub
And in Command2 since you wanted oen to end the program:
Code:
Private Sub Command2_Click()
End
End Sub
The above function will read a textfile on each line and put it into a Listbox of your choice. By pressing the Command1 button, you will open the textfile, and add all the lines in it into the Listbox on their own line, just as they were in the txt file.
Private Sub List1_Click(Index As Integer)
Open "C:\pos\bob.txt" For Input As #1
Line Input #1, g
Close #1
For X = 1 To 1
List1.AddItem g
Next X
End Sub