Re: The big Debate on DoEvents

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I've written a couple threading programs but I'm not an expert enough to help on that front. It does seem the logical thing to do.

It might not be good form now that we can program threads but perhaps some old fashioned programming would work too. Have you considered using a counter and only calling doevents on every 10 or 20th time you update the progressbar? You know, increment the counter each time the progress bar is run and if the counter modulus 10 or 20 or whatever you pick = 0 then doevents. Better yet make 10 or 20 into a variable and you can adjust responsiveness vs speed on the fly.


Dave wrote:
Ok All,

I have a program that receives information from the serial port.
Occasionally this information requires me to raise an event and update
a progressbar telling me how much of the information I have received.
My problem lies there. When i update the progressbar, I need to update
the display.... progressbar.refresh, nice and simple, however, if the
user clicks on the screen at any point whilst receiving information
from the serial port, the whole program appears to lock up.... the
screen goes white until the information has completed receiveing
information on the serial port. I therefore implemented an
Application.doevents() after updating the progressbar. This has slowed
the whole process down completely. The information I receive takes
about 1 minute to receive, however with a DoEvents call it takes twice
as long.... this is not acceptable!

Does anyone have any idea how to speed this up whilst also keeping the
form alive? I can't allow my users to see a (not responding) at the
top of the screen and I can't afford to have the time it takes to
receive anything double!

Please help!

Thanks

Dave

.



Relevant Pages

  • Re: The big Debate on DoEvents
    ... I have a program that receives information from the serial port. ... a progressbar telling me how much of the information I have received. ... user clicks on the screen at any point whilst receiving information ... process that should be running in a separate thread and would be a ...
    (microsoft.public.dotnet.languages.vb)
  • Re: The big Debate on DoEvents
    ... avoid Application.DoEvents and deal with the serial port processing in ... I have a program that receives information from the serial port. ... a progressbar telling me how much of the information I have received. ... user clicks on the screen at any point whilst receiving information ...
    (microsoft.public.dotnet.languages.vb)
  • The big Debate on DoEvents
    ... I have a program that receives information from the serial port. ... Occasionally this information requires me to raise an event and update ... a progressbar telling me how much of the information I have received. ... user clicks on the screen at any point whilst receiving information ...
    (microsoft.public.dotnet.languages.vb)
  • Re: The big Debate on DoEvents
    ... I have a program that receives information from the serial port. ... Occasionally this information requires me to raise an event and update ... a progressbar telling me how much of the information I have received. ... user clicks on the screen at any point whilst receiving information ...
    (microsoft.public.dotnet.languages.vb)