I have code to delete a file, create another (so that I can rewrite it) and write on it.
My.Computer.FileSystem.DeleteFile("./pass") File.Create("./pass") My.Computer.FileSystem.WriteAllText("./pass", MaskedTextBox1.Text, True)
When he begins to write the text, he says:
An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll Additional information: The process cannot access the file '[path]\pass' because it is being used by another process.
Is there a way to resolve this issue, or maybe just just overwrite the file without deleting it and creating it again?
source share