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 Chris Miller 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

Status
Not open for further replies.

RobSchultz

Programmer
Jun 1, 2000
444
US
I have a problem with a timer (VB6 SP3). Pseudo code as follows...
Code:
User clicks a button that...
Instantiates a MS Common Dialog box...
User selects an Excel spreadsheet...
Timer is enabled (the problem is it doesn't start)...
The excel file is parsed for the necessary information...
  While this is happening the timer is supposed to be drawing a progress bar in a text box status bar on the form (but doesn't)...
Finishes parsing the file...
Disables the timer...
Displays the results...

The timer/progress bar work fine outside of the MS Common Dialog / Excel.Application object parsing. I've set the timer routine to call the form.textbox.text as well as the standard textbox.text (there is only one form in the program so far).

Any help would be greatly appreciated, [sig]<p>Rob<br><a href=mailto:robschultz@yahoo.com>robschultz@yahoo.com</a><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
"Focus on the solution to the problem,<br>
not the obstacles in the way."<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/sig]
 
whenever you are inside a loop (as you probably are while parsing the excel data) the other events going on will not be handled unless you add this line into your loop.

DoEvents

Basically any time you are in a loop doing a long operation this line will let VB keep redrawing your form, handling input, etc.. [sig]<p>Ruairi<br><a href=mailto:ruairi@logsoftware.com>ruairi@logsoftware.com</a><br>Experienced with: <br>
VB6, SQL Server, QBASIC, C(unix), MS Office VBA solutions<br>
ALSO: Machine Control/Automation using GE and Omron PLC's and HMI(human machine interface) for industrial applications[/sig]
 
Thank you! That did the trick.

Later, [sig]<p>Rob<br><a href=mailto:robschultz@yahoo.com>robschultz@yahoo.com</a><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
"Focus on the solution to the problem,<br>
not the obstacles in the way."<br>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top