Raddict
Active member
Hi,
I have a textfile where constantly (about every 10 sec.) text is being added (a log from a temperature sensor).
I can read the last added line with a VB.NET program.
But I can't get it to repeat this over and over again, without restarting the program or reopen it with my fileopen dialog.
I use this code to read the file:
apperantly the file is not closed properly, so the progam does not open the updated file but the old one when I run the try to end try part again with my Timer.
Can anyone tell me how to fix this
I have a textfile where constantly (about every 10 sec.) text is being added (a log from a temperature sensor).
I can read the last added line with a VB.NET program.
But I can't get it to repeat this over and over again, without restarting the program or reopen it with my fileopen dialog.
I use this code to read the file:
VB.NET:
dlgFile.opendialog
filename=dlgFile.filename
Try
Dim sr As StreamReader = New StreamReader(filename)
Do
line= sr.ReadLine
wanted_value=line 'only the last line is preserved
Loop Until regel Is Nothing
sr.Close()
Catch ex As Exception
End Try
apperantly the file is not closed properly, so the progam does not open the updated file but the old one when I run the try to end try part again with my Timer.
Can anyone tell me how to fix this