Can't open '<filename>' for writing

The specified file cannot be opened for writing, perhaps because it has already been opened.

Error ID: BC2012

To correct this error

  1. Close the file and reopen it.

  2. Check the file's permissions.

See Also

Reference

My.Computer.FileSystem.WriteAllText Method

My.Computer.FileSystem.WriteAllBytes Method

Other Resources

Writing to Files in Visual Basic