Can you give the rest of the code, including the Form1 class? What you have here doesn't make sense out of context. You have a constructor called Monitor, which means that this code is inside a class called Monitor, yet you reference a 'Form1' object.
Without knowing what exactly is going on, try the following code to see if it fixes your issue.
Code:private static void OnTimedEvent(object source, ElapsedEventArgs e) { Console.WriteLine("Worked"); string text = System.IO.File.ReadAllText(@"G:\Monitor.txt"); txt_Monitor.Text = text + "/125"; Console.WriteLine(text); }




Reply With Quote