multithreading - Timer interrupt problem in vb.net -
I have 2 timers in the MVB 2008 Express, one to control the fading of the window and another to call a beep function The problem is for a few seconds or so that when the window is fading, it pauses during the timer beep. any idea? Can Threads be?
Without seeing your code, I have found that it is actually related to thread. / P>
It seems that you have a Windows application, where two timers
controls are sitting on a form. You probably have code within the tick
event for each timer to perform relevant functions, to fade one, to beep another
What's happening here is that these two functions are running in the same thread defined in the tick
events. This is the same thread that is used for your Windows Form UI (User Interface). When trying to execute the long-running process, you can see the same problem while trying to update some part of your form - usually "stop" or "hang" when all form updates Until the ongoing process is completed.
To fix this problem, one of the code codes (if not both) will be required, which the timer
has its own tick
event one Play in different threads.
The easiest way to achieve this is through component (or class). Alternatively, you can instantiate your own representative and use it (which is the same background worker component!)
Something similar is:
< Code> import system. Public class formatting form 1 handles the timer in private sub-timer 1 volt (system-wise as the sender, System.Ovject, ByVal E.). Thread newThread = New Thread as Tim Demat New Thread (Addressoff Dowworker) newThread.Start () and Sub Private All Dover () / Long-Term Process Here Ends Sub-End Class
Comments
Post a Comment