vb中保存列表框的内容为一个txt文件

来源:百度知道 编辑:UC知道 时间:2024/05/19 16:39:57
要求给出源代码

Private Sub Command1_Click()
Dim i%, a$
For i = 0 To List1.ListCount - 1
a = a & List1.List(i) & vbCrLf
Next

Open "c:\list.txt" For Output As #1
Print #1, a
Close #1
End Sub

Private Sub Command1_Click()
Dim I As Integer

Open "c:\1.txt" For Output As #1
For I = 1 To List1.ListCount
Print #1, List1.List(I)
Next I
Close #1
End Sub

正确