Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

timer not firing during busy recursive function 1

Status
Not open for further replies.

g33man

Programmer
Dec 22, 2006
50
0
6
CA
I have a sub that recurses a directory structure (using GetFiles and GetDirectories). My form has a label to provide progress feedback. I have a Timer which fires every 1000 msecs, puts the current time (in seconds) in the label, and calls label1.update(). The label updates every second as expected, but as soon as the recursive sub starts, the label freezes until the sub completes. The sub takes about 8 seconds to complete. When the sub returns, the label resumes its update every second. My gut instinct is that the app is so busy recursing my directory that it is unable to service the timer. Suggestions?

Thanks
 

Try putting a call to Application.DoEvents in the recursive sub and in the timer's Tick event handler.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Application.DoEvents() at the start of my sub solved this.
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top