Hello
I try to rename a file by
file.copy(oldPathName, newPathName)
then
file.delete(oldPathName)
File.copy works. But somehow, a message saying oldPathName is being used by another process, when it tries to delete the old file.
Any idea why this happened and how to make it works.
Thanks
Quin

file rename in VB .net
Kevin Hoffman
mkb2006
Why not use the My.Computer.FileSystem.RenameFile Method to do the job rather than creating your own combination of copy and delete. There are more issues involved in recreating your own two step process such as timing, and fallback if failure occurs. I've found its almost always better to use whats available rather than trying to recreate the wheel.
My.Computer.Filesystem.RenameFile
http://msdn2.microsoft.com/en-us/library/2ce15by3.aspx
nglow