VB中如何在filelistbox上保存所选的文件

来源:百度知道 编辑:UC知道 时间:2024/06/21 19:34:12
我设置了一个filelistbox 和一个保存按钮
在filelistbox上选择一个文件单击保存文件就能保存到相应路径
用commonDialog对话框进行保存

Private Sub Command1_Click()
For i = 0 To File1.ListCount - 1
If File1.Selected(i) = True Then
x = InputBox("欲复制位置", "复制", "d:\" & File1.List(File1.ListIndex))
If x <> "" Then
FileCopy File1.Path & IIf(Right(File1.Path, 1) = "\", "", "\") & File1.List(File1.ListIndex), x
End If
End If
Next
End Sub

Private Sub Form_Load()
File1.Path = "d:\"
End Sub

======================================================

年轻人要多动脑 用inputbox对话框 做 和commonDialog对话框是一样的
自己都不尝试去改改 就算学VB只是应付考试 但也不能一味靠别人做好的给你 养成脑残的习惯可不好哦 会变更笨的
Private Sub Command1_Click()
For i = 0 To File1.ListCount - 1
If File1.Selected(i) = True Then
CommonDialog1.ShowSave
If CommonDialog1.FileName <> "" Then
FileCopy File1.Path & IIf(Right(File1.Path, 1) = "\", "", "\&qu