How can i save my listboxcontents to a file (.txt file)...
Printable View
How can i save my listboxcontents to a file (.txt file)...
VB Code:
Option Explicit Private Sub Command1_Click() 'saves Dim LoopCount As Integer Open "c:\test.txt" For Output As #1 For LoopCount = 0 To List1.ListCount - 1 Print #1, List1.List(LoopCount) Next Close #1 End Sub Private Sub Command2_Click() 'loads Dim Data As String Open "c:\test.txt" For Input As #1 Do Until EOF(1) Line Input #1, Data List1.AddItem Data Loop Close #1 End Sub Private Sub Form_Load() List1.AddItem "1" List1.AddItem "2" List1.AddItem "3" End Sub
Thanx! Works perfect...:D