|
-
Nov 9th, 2000, 02:01 PM
#1
Thread Starter
Addicted Member
i want to open a txt file (using commondialog) and load it in the list box, the file should be like that:
http://blah.com/123.exe
http://123.com/blah.exe
etc
*Rudy^
Visual Studio 6 Ent. SP5
Windows 2000 SP4
Windows XP SP1a
-
Nov 9th, 2000, 02:06 PM
#2
Frenzied Member
Code:
Dim fn%, tmp$
fn = FreeFile
Open TXTFILE for Input As #fn
Do While Not(Eof(1))
Line Input #fn, tmp
List1.Additem tmp
Loop
Close #fn
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 9th, 2000, 05:47 PM
#3
Thread Starter
Addicted Member
hum....... now how about a way to save that list back in a txt file?? i knwo i didnt' asked for it but now i am ^_*
*Rudy^
Visual Studio 6 Ent. SP5
Windows 2000 SP4
Windows XP SP1a
-
Nov 9th, 2000, 07:00 PM
#4
Code:
Public Sub List_Load(TheList As ListBox, FileName As String)
On Error Resume Next
Dim TheContents As String
Dim fFile As Integer
fFile = FreeFile
Open FileName For Input As fFile
Do
Line Input #fFile, TheContents$
TheList.AddItem TheContents$
Loop Until EOF(fFile)
Close fFile
End Sub
Public Sub List_Save(TheList As ListBox, FileName As String)
On Error Resume Next
Dim Save As Long
Dim fFile As Integer
fFile = FreeFile
Open FileName For Output As fFile
For Save = 0 To TheList.ListCount - 1
Print #fFile, TheList.List(Save)
Next Save
Close fFile
End Sub
-
Nov 9th, 2000, 11:47 PM
#5
Thread Starter
Addicted Member
thanx to both of you, i used Matt's code because it has the save code too, but thanx to jop too, the only reason i didn't used ur code was cause i was at school on the wrong classroom when i read the msg (that classroom didn't had VB) and when i got home Matt had both code so i used his code
*Rudy^
Visual Studio 6 Ent. SP5
Windows 2000 SP4
Windows XP SP1a
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
|