Timer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anagno
    New Member
    • Jan 2008
    • 3

    Timer

    Hello all.
    I am developing this program:
    It has a form with a text box in which user types a number (minutes). Then, he press a button "Start" which counts backwards the interval minutes in the textbox (in seconds) and when the time ends the program does something that it isn't necessary to mention here.

    I want to make this work without using Threads, it is working with Threads but it reserves 99% of my CPU !

    Thank you in advance.
  • minhnhat2807
    New Member
    • Dec 2007
    • 4

    #2
    Originally posted by Anagno
    Hello all.
    I am developing this program:
    It has a form with a text box in which user types a number (minutes). Then, he press a button "Start" which counts backwards the interval minutes in the textbox (in seconds) and when the time ends the program does something that it isn't necessary to mention here.

    I want to make this work without using Threads, it is working with Threads but it reserves 99% of my CPU !

    Thank you in advance.
    According to me, no any way for you

    Comment

    • leoiser
      New Member
      • Jul 2007
      • 41

      #3
      put the time in timer


      in timer event write the code...

      //here please disable the timer otherwise it will call again & again
      Thread t = new System.Threadin g.Thread(new System.Threadin g.Parameterized ThreadStart(Dop rocess));
      t.IsBackground = true;
      t.start();



      Originally posted by Anagno
      Hello all.
      I am developing this program:
      It has a form with a text box in which user types a number (minutes). Then, he press a button "Start" which counts backwards the interval minutes in the textbox (in seconds) and when the time ends the program does something that it isn't necessary to mention here.

      I want to make this work without using Threads, it is working with Threads but it reserves 99% of my CPU !

      Thank you in advance.

      Comment

      • Anagno
        New Member
        • Jan 2008
        • 3

        #4
        I wrote a version using a timer control but the problem was that while counting backwards, the form couldn't be moved or even viewed!
        Maybe this cannot work without using threads... ;-(
        Unfortunately I am not familiar with this type of code (I support this program, it was not written by me).
        I suppose that the code below is for threads.
        If you could be more specific I would appreciate that.

        Thank you in advance.


        Originally posted by leoiser
        put the time in timer


        in timer event write the code...

        //here please disable the timer otherwise it will call again & again
        Thread t = new System.Threadin g.Thread(new System.Threadin g.Parameterized ThreadStart(Dop rocess));
        t.IsBackground = true;
        t.start();

        Comment

        Working...