Hi
Can anyone help me i am try ing to copy a file from one location to another useing an openfile dialog but it dosn't seem to work any ideas welcome. The code i am using is below
FileCopy(OpenFileDialog1.FileName, "C:\temp\trial.tar")
Printable View
Hi
Can anyone help me i am try ing to copy a file from one location to another useing an openfile dialog but it dosn't seem to work any ideas welcome. The code i am using is below
FileCopy(OpenFileDialog1.FileName, "C:\temp\trial.tar")
Hi,
try using the File Class
CurtCode:
Imports System.IO.File
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim FileToCopy As String
Dim NewCopy As String
OpenFileDialog1.ShowDialog()
FileToCopy = OpenFileDialog1.FileName.ToString
'FileToCopy = "c:\temp\test1.txt"
NewCopy = "c:\temp\test2.txt"
If System.IO.File.Exists(FileToCopy) = True Then
System.IO.File.Copy(FileToCopy, NewCopy, True)
MessageBox.Show("File Copied")
Else
MessageBox.Show("File doesn't exist")
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
Thanks
I'll give that a go over the weekend and let you know
Ok that seems to work ok
However if i try to copy a file from my external usb drive it comes up with an error of file already in use
Any idea's!