|
-
Apr 3rd, 2005, 12:32 PM
#1
Addicted Member
The Tempest Shall Never Die.
-
Apr 3rd, 2005, 12:33 PM
#2
Thread Starter
Banned
Re: need help fixing it?
I did it and it dose not work.
-
Apr 3rd, 2005, 01:08 PM
#3
Addicted Member
Re: need help fixing it?
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.
-
Apr 3rd, 2005, 01:09 PM
#4
Thread Starter
Banned
Re: need help fixing it?
-
Apr 3rd, 2005, 01:14 PM
#5
Addicted Member
Re: need help fixing it?
For what you're doing, you'd need:
__________________
"bob"
"jack"
"some other guy"
__________________
Or use "Line Input" instead of "Input"
-
Apr 3rd, 2005, 01:17 PM
#6
Thread Starter
Banned
Re: need help fixing it?
new code
Option Explicit
Dim g
Dim h
Private Sub Command1_Click()
End
End Sub
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
-
Apr 3rd, 2005, 01:16 PM
#7
Hyperactive Member
Re: need help fixing it?
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.
If my post was helpful please rate it 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|