Timer event and threading in RRS feed

  • Question

  • Hi,


          I am using a timer event which is a static control and it will be added in a form and we are having a separate class for doing file scanning  and based on the filescan count we need to update the timer. for performance issue we added the Scanning part as a separate thread and now the problem is when the thread starts then the timer event is not triggering at all. Timer event and File scan is in a separate class.

    If we remove the threading and directly running the function . then the timer event is updating the progress bar


    Please sugget me what is wrong ? and let me know if you need further clarification






    Monday, February 4, 2008 12:42 PM


  • This Windows timer is designed for a single-threaded environment where UI threads are used to perform processing. It requires that the user code have a UI message pump available and always operate from the same thread, or marshal the call onto another thread.

    The Windows Forms Timer component is single-threaded, and is limited to an accuracy of 55 milliseconds. If you require a multithreaded timer with greater accuracy, use the Timer class in the System.Timers namespace.

    Friday, February 8, 2008 3:09 AM