Application.Doevents hanging

J

John H

I am calling Application.DoEvents in my timer event after doing some
processing. I am finding that the app is hanging on the
Application.DoEvents call in some scenarios. Does not happen
everytime I repeat the steps in the app. I can comment out the
DoEvents call and then I will not get the hanging problem. Problem
then is that the app will not respond to user input. Has any one else
send this behavior on CF apps.
 
D

Dick Grier

Hi,

Are you in a loop inside the timer event? I haven't seen any hangs, in this
scenario (are you sure it is hanging on DoEvents, and not something else in
the loop?) -- but there is no other reason to use DoEvents, IMO. Perhaps,
as Chris says, using a thread to do your processing is the answer. You can
either use the Timer event to create a thread (make sure that it exits in a
"timely fashion"), or use the .Threading.Timer class.

BTW, does the loop that is in the Timer event take longer to execute than
the Timer interval? If so, you may need to consider your design.

Dick
--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top