VB编写一个程序,实现文件的移动。
1个回答
展开全部
写了一个函数,调用这个函数就好了,比如:MoveFile "D:\1.jpg", "D:\2.jpg"
返回值为true时代表移动成功,返回false时移动失败
Function MoveFile(ByVal SrcFile As String, DestFile As String) As Boolean
If SrcFile = "" Or DestFile = "" Then Exit Function
If SrcFile = DestFile Then Exit Function
On Error GoTo ErrTag
FileCopy SrcFile, DestFile
Kill SrcFile
MoveFile = True
Exit Function
ErrTag:
End Function
返回值为true时代表移动成功,返回false时移动失败
Function MoveFile(ByVal SrcFile As String, DestFile As String) As Boolean
If SrcFile = "" Or DestFile = "" Then Exit Function
If SrcFile = DestFile Then Exit Function
On Error GoTo ErrTag
FileCopy SrcFile, DestFile
Kill SrcFile
MoveFile = True
Exit Function
ErrTag:
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询