vb中如何复制textbox1下指定路径文件到textbox2下,我的代码如下
PrivateSubCommand1_Click()OnErrorGoToerrText1.Text="d:\11.txt"Text2.Text="d:\22.txt"D...
Private Sub Command1_Click()
On Error GoTo err
Text1.Text = "d:\11.txt"
Text2.Text = "d:\22.txt"
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Dir(Text1.Text) <> "" Then
FileCopyfso.CopyFile App.Path & "Text1.Text", "Text2.Text"
End If
Exit Sub
err:
MsgBox "错误"
End Sub 展开
On Error GoTo err
Text1.Text = "d:\11.txt"
Text2.Text = "d:\22.txt"
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Dir(Text1.Text) <> "" Then
FileCopyfso.CopyFile App.Path & "Text1.Text", "Text2.Text"
End If
Exit Sub
err:
MsgBox "错误"
End Sub 展开
2个回答
展开全部
Private Sub Command1_Click()
On Error GoTo err
Text1.Text = "d:\11.txt"
Text2.Text = "d:\22.txt"
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Dir(Text1.Text) <> "" Then
fso.CopyFile Text1.Text, Text2.Text
End If
Exit Sub
err:
MsgBox "错误"
End Sub
百度HI vb6专家群1358368
On Error GoTo err
Text1.Text = "d:\11.txt"
Text2.Text = "d:\22.txt"
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Dir(Text1.Text) <> "" Then
fso.CopyFile Text1.Text, Text2.Text
End If
Exit Sub
err:
MsgBox "错误"
End Sub
百度HI vb6专家群1358368
追问
如果不是复制文件内容,而是把d:\11.txt文件复制到d盘下以22为文件夹的目录下 该怎么弄呢,我改成
Text1.Text = "d:\11.txt"
Text2.Text = "d:\22"后出现错误
追答
Text2.Text = "d:\22\"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询