Results 1 to 4 of 4

Thread: Timer OnTimedEvent isn't updating my form

Threaded View

  1. #2
    Lively Member
    Join Date
    Dec 2005
    Posts
    68

    Re: Timer OnTimedEvent isn't updating my form

    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);     
    }
    Last edited by lunchboxtheman; Jan 7th, 2010 at 11:41 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width