VB listbox 保存成txt文件
答案:2 悬赏:70 手机版
解决时间 2021-01-03 23:21
- 提问者网友:杀生予夺
- 2021-01-03 13:20
有大神能写段用 commondialog.showsave然后保存list里面的所以item到text文件么?
最佳答案
- 五星知识达人网友:青灯有味
- 2021-01-03 13:32
private sub command1_click()
list1.additem text1
end sub
private sub command2_click()
list1.removeitem list1.listindex
end sub
private sub command3_click()
list1.list(list1.listindex) = text1
end sub
private sub command4_click()
open "d:\1.txt" for output as #1
for i = 0 to list1.listcount - 1
print #1, list1.list(i)
next
close
end sub
private sub form_load()
open "d:\1.txt" for input as #1
do until eof(1)
line input #1, a
list1.additem a
loop
close
end sub
list1.additem text1
end sub
private sub command2_click()
list1.removeitem list1.listindex
end sub
private sub command3_click()
list1.list(list1.listindex) = text1
end sub
private sub command4_click()
open "d:\1.txt" for output as #1
for i = 0 to list1.listcount - 1
print #1, list1.list(i)
next
close
end sub
private sub form_load()
open "d:\1.txt" for input as #1
do until eof(1)
line input #1, a
list1.additem a
loop
close
end sub
全部回答
- 1楼网友:人類模型
- 2021-01-03 14:29
Private Sub Command1_Click()
Open App.Path & "\1.txt" For Output As #1
For i = 0 To File1.ListCount - 1
Print #1, Left(File1.List(i), Len(File1.List(i)) - 4)
Next i
Close
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Form_Load()
File1.Pattern = "*.jpg"
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯