Error on File.Move

elmo

New member
Joined
Feb 5, 2004
Messages
1
Dim sPath As String
Dim sNew As String
Dim sName As String

sPath = TreeView1.SelectedNode.Text
sName = Path.GetFileName(sPath)
sNew = "C:\TestMe\" & sName

Ensure that the target does not exist.
If File.Exists(sNew) Then
File.Delete(sNew)
End If

Move the file.
File.Move(sPath, sNew)

Error on file.move command
Why the error? "C:\TestMe\00000004.MAG" does not even exist yet.



An unhandled exception of type System.IO.IOException occurred in mscorlib.dll

Additional information: The process cannot access the file "C:\TestMe\00000004.MAG" because it is being used by another process.
 
Back
Top