004
07.08.2004, 12:46 Uhr
cOdexer
|
also fürs lesen und schreiben einer listbox hab ich mal fix nen sample gebastelt..
Visual Basic: |
Private Sub ListIOstream(bList As ListBox, Modus As Integer) Dim lstPath As String Dim lstFileR As Long Dim lstFileO As Long Dim lstContainer As String Dim I As Integer lstPath = "C:\Test.txt" lstFileO = FreeFile Select Case Modus Case 1 Open lstPath For Output As #lstFileO For I = 0 To bList.ListCount - 1 Print #lstFileO, bList.List(I) Next Close #lstFileO Case 2 lstFileR = FreeFile Open lstPath For Input As #lstFileR While Not EOF(lstFileR) Line Input #lstFileR, lstContainer bList.AddItem lstContainer Wend Close #lstFileR Case Else: Exit Sub End Select End Sub Private Sub Command1_Click() Call ListIOstream(List1, 2) End Sub Private Sub Command2_Click() Call ListIOstream(List1, 1) End Sub Private Sub Form_Load() For h = 1 To 100: List1.AddItem CStr(h): Next Command1.Caption = "Laden" Command2.Caption = "Speichern" End Sub
|
Man benötigt um das sample 100% erfolgreich zu testen, eine Listbox(List1) und 2 CommandButtons (Command1; Command2)
zu der OLE sache, hier ist der link www.rst-consult.com/database/vb4/v6
-> have fun |