/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
FileListBox
Fra : Sjoerd


Dato : 19-09-02 09:44

Hello,

I use a FileList-box and want to write the content of this box to a
text-file. I assume this is possible, but how????

First open a file for output
Then using a loop-statement to read alle the entries of the FileListBox
Finally close the output-file

What is the code for the "loop-part"?


Thanks for helping me.

Sjoerd

svo@home.nl



 
 
John Doe (19-09-2002)
Kommentar
Fra : John Doe


Dato : 19-09-02 11:46

Assumening your file-box is named: "file1".

Add a command-button: "command1"

Paste:
'----------------------------------------------------------
Private Sub Command1_Click()

Dim fso As Object
Dim oFile As Object
Dim i As Integer

Set fso = CreateObject("Scripting.FileSystemObject")

Set oFile = fso.CreateTextFile("c:\out.txt", True) 'True = overwrite

'Loop-part
For i = 0 To File1.ListCount - 1
oFile.WriteLine File1.List(i)
Next i

oFile.Close

End Sub

'----------------------------------------------------------



Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408522
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste