[RESOLVED] Wait for a text file to stop being written to, then open the text file?
Hi All,
Is there a way vb.net 2005 can check to see when a file is done begin written to, then open that file and pull it's contents into a listbox?
I have a command line outputting data to a text file, then having my vb.net app pull the file from the text file to a listbox. Currently I have it working off of a delay, but this can be problematic due to underestimating the write time, then the .net app can not pull the data at all.
If there is a way for vb.net to wait, check, wait, check, if done, pull the data to a listbox? This would certainly be much better than a manual delay.
Any help would be much appreciated. Thanks!
Re: Wait for a text file to stop being written to, then open the text file?
Start a Timer and try to open the file in the Tick event handler. If it succeeds then stop the Timer and read the data, otherwise let the Timer keep on Ticking.
Re: Wait for a text file to stop being written to, then open the text file?
Thanks jmcilhinney,
That worked perfectly! :D