sicKo
sicKo

Reputation: 1256

How do I write to an opened file in vb.net

How do I write to an opened file in vb.net

I'm using this function right now

My.Computer.FileSystem.WriteAllText(filepath, createString(), True)

However, if the file is opened, it will give an error saying that the file is being used by another process. It works if the file is closed.

So how do i update the file content while it is open? The file need to be written while its open.

Upvotes: 1

Views: 312

Answers (1)

PeterJ
PeterJ

Reputation: 3788

If the application reading the file is something you don't have the source code to there's not much you can do about it, it must be opening the file in a mode that denies write access. If you wrote the application that is reading the file you may be able to do something like the following to allow read/write sharing of the file:

Read file without exclusive lock

Upvotes: 1

Related Questions