Log file scanning vb.net ... problem

  • 12 years ago

    I have a log file (eg logfile.txt) which is continously updated (with the values on and off from various equipments) such as:




    Now i have buttons on a vb.net form corresponding to each of the equipments such as CCC, DDD, EEE, XXX and FFF. I have to have a program which continuosly reads the updated value in the log file and change the color of the button to green (on) and blue (off). The log file is updated every 1 second so new values for all the equipments have to be scanned (the values are appended in line wise as shown above). Can anyone please help to guide as to how can i read and scan the file for the updated values only, every SECOND so that i can have the corresponding buttons turned on green and red depending on the values read.

    Thanks .... PLEASE HELP


  • 12 years ago

    The simplest method Romez is to implement the FileSystemWatcher, and just set the appropriate properties. The problem you are going to have is how do I know what has changed? The only answer I can see is to have a in-memory copy of the log file that you can compare against.

    Because of the constant updating however, I would check your CPU usage, just to make sure you are not peaking.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”