My earlier post was unreadable so. I am trying to read the last line of a text file every time it changes. The code I have is,
private void fileSystemWatcherMCH1_Changed(object sender, System.IO.FileSystemEventArgs e)
{
string machState = File.ReadAllLines(@"C:\Users\sgarner\Documents\PROTOMET SHOP FLOOR\Machines\MACHINE_1.txt").Last();
btnMCH1.Text = machState;
btnMCH1.BackColor = Color.Blue;
}
If I only run the btnMCH1.BackColor = Color.Blue;
it works. But I cannot read in the variable from the text file.
I am certain I am missing something simple.
Thanks,