Hey All,
I'm currently trying to get a little VB.Net app running that has a
FileWatcher watching a log file being generated by the PortReporter
utility.
The filewatcher has no problem notifying of a change in file size,
however, i'm trying to read the changed text from the file and operate
on it.
The problem arises when i try to open the file, it doesn't matter what
i do, it always returns "An unhandled exception of type
'System.IO.IOException' occurred in mscorlib.dll".
I have tried all manner of opening the file and always seem to get the
error:
EG's:
Code:Dim fiLogFile As New FileInfo(txtLogFileName.Text) Dim fs As FileStream fsFile = fiFile.OpenRead() <-- Errors on this lineCode:FileOpen(1, txtLogFileName.Text, OpenMode.Binary)The kicker is that i have no problems opening and viewing the file inCode:Dim fs As New FileStream(txtLogFileName.Text, FileMode.Open, FileAccess.Read)
notepad and another editor called editplus.
Anyone happen to know a way to view a locked text file in vb.net?
Not being able to work out notepad's dirty little secret is driving me
nuts!
Thanks for any help you can give me
Matt





Reply With Quote