Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

How to handle two programmes accesing the same file?

$
0
0
Hi, i have two VB.NET programs, namely A and B, basically they are two different EXE. Program A will generate a text file and save in particular folder from time to time. Program B will then have a timer loop which checks the folder if there is any new text file generated by program A. If there is, program B will open the file, read the values and delete the file. My concern is there are chances where the program A is still accessing the fie (in the middle of generating) while program B detected the new text file and open and delete it and this will throw exception error.

May i know is there any way for program B to check whether the text file is still being accessed by program A and wait for it to be completed before open and delete it?

Please advice.

Viewing all articles
Browse latest Browse all 27189

Trending Articles