From the sounds of it, the File variable you're passing to the RenameFile method either isn't a full file path or it's a path to a file that doesn't exist. I really can't tell which is the case here.
Here's what I did: I created a text file: C:\Test.txt and typed some random chars it in and saved it.
I then created a new WinForms app, added a button and put this code in:
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
My.Computer.FileSystem.RenameFile("C:\Test.txt", "Test1.txt")
End Sub
I checked my C: drive and sure enough, the file was renamed.
So then it's something else going on with your code, it means that after the file is renamed somewhere else you're still trying to use the old name or something.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.