Hello Everyone,
I need some help here, I have a form on which I have all the user interface components, and I need to do a big calculation every 5 seconds. I used the Timer object to do this calculation every 5 seconds. So far so good, but my calculation takes about 2-3 seconds and because of that it made my form very unresponsive for that period of time, which is never acceptable.
I googled the problem and found that If I use System.Timer.Ti mers object It should not block the Form’s thread, because it runs on it own thread. I did that and still same results. After every 5 seconds when my Timer Click happens my form becomes unresponsive for 2-4 seconds. By googling further I found that the SychronizationO bject of the timer is the property that makes sure that the timer synchronizes with that object. I changed that property to a label in my form but that did not help, may be because the label itself is in the same thread of Form.
Can I make a synchronization object in my code and set the property of my timer to that object? If yes, how can I do that. I no what are other way around to this problem. Can anyone help me in figuring this out?
By the way this is my Timer’s Properties:
AutoReset: True
SychronizationO bject: myForm
Thanks in advance for your help.
Jerry.
I need some help here, I have a form on which I have all the user interface components, and I need to do a big calculation every 5 seconds. I used the Timer object to do this calculation every 5 seconds. So far so good, but my calculation takes about 2-3 seconds and because of that it made my form very unresponsive for that period of time, which is never acceptable.
I googled the problem and found that If I use System.Timer.Ti mers object It should not block the Form’s thread, because it runs on it own thread. I did that and still same results. After every 5 seconds when my Timer Click happens my form becomes unresponsive for 2-4 seconds. By googling further I found that the SychronizationO bject of the timer is the property that makes sure that the timer synchronizes with that object. I changed that property to a label in my form but that did not help, may be because the label itself is in the same thread of Form.
Can I make a synchronization object in my code and set the property of my timer to that object? If yes, how can I do that. I no what are other way around to this problem. Can anyone help me in figuring this out?
By the way this is my Timer’s Properties:
AutoReset: True
SychronizationO bject: myForm
Thanks in advance for your help.
Jerry.
Comment