急求~~~~~~~把list的内容写入txt后怎么再从txt中读出?????
Dim a As Integer
Open App.Path & "\文档.txt" For Output As #1
For a = 0 To List1.ListCount - 1
Print #1, List1.List(a)
Next a
Close #1
...全文
762打赏收藏
急求这个问题谁会
急求~~~~~~~把list的内容写入txt后怎么再从txt中读出????? Dim a As Integer Open App.Path & "\文档.txt" For Output As #1 For a = 0 To List1.ListCount - 1 Print #1, List1.List(a) Next a Close #1
Dim a As Integer, strTmp As String
Open App.Path & "\文档.txt" For Input As #1
List1.Clear
Do Until EOF(1)
Line Input #1, strTmp
List1.AddItem strTmp
Loop
Close #1
If List1.ListCount Then List1.ListIndex = 0
Private Sub Command1_Click() '写入
Open fname For Output As #1
For i = 0 To List1.ListCount - 1
Print #1, List1.List(i)
Next i
Close #1
MsgBox "写入完成"
End Sub
Private Sub Command2_Click() '读出
If Dir(fname) <> "" Then
List1.Clear
Open fname For Input As #1
While Not EOF(1)
Line Input #1, aa
List1.AddItem aa
Wend
Close #1
MsgBox "读取完成"
End If
End Sub