I have some code to delete a file, make another one (so i can overwrite it) and write on it.
My.Computer.FileSystem.DeleteFile("./pass")
File.Create("./pass")
My.Computer.FileSystem.WriteAllText("./pass", MaskedTextBox1.Text, True)
When it gets to write the text it 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 solve this or maybe a way to just overwrite the file without deleting and making it again?