vb6中,listbox中的内容怎么存储到当前目录的TXT中,对应着一行一行的。谢谢,求代码!!
2个回答
展开全部
保存的代码:
On Error Resume Next
Dim i As Integer
Open App.Path + "\1.txt" For Output As #1 '可以把文件名更改成自己需要的文件名
For i = 0 To List1.ListCount - 1
Print #3, List1.List(i)
Next i
Close #1
顺便给个读取的代码:
Dim MyString As String
Open App.Path + "\LIST.LST" For Input As #1
Do While Not EOF(1)
DoEvents
Line Input #1, MyString
Combo1.AddItem MyString
Loop
Close #1
On Error Resume Next
Dim i As Integer
Open App.Path + "\1.txt" For Output As #1 '可以把文件名更改成自己需要的文件名
For i = 0 To List1.ListCount - 1
Print #3, List1.List(i)
Next i
Close #1
顺便给个读取的代码:
Dim MyString As String
Open App.Path + "\LIST.LST" For Input As #1
Do While Not EOF(1)
DoEvents
Line Input #1, MyString
Combo1.AddItem MyString
Loop
Close #1
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询