Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: How to stop a process


Message #1 by "Raheem" <raheem@f...> on Sun, 17 Jun 2001 14:33:16
Raheem,

many suggested correctly to use DoEvents, but no one mentioned that
using DoEvents 1) makes the application very slow and 2) it messes up
all your user events. To fix the first problem, call DoEvents every 10-20
times in your loop (you have to test for performances) and to fix the
second (this is my favorite approach) do NOT use DoEvents, but put
your code in a timer. In the timer function, just loop 10-20 times only
(as before, it depends on the application), and at the end of the loop
check for the Cancel button status-a global variable will do. If the
button was hit, do not restart the timer, otherwise restart it if there
are more loops to execute.

m.


> -----Original Message-----
> From:	Raheem [SMTP:raheem@f...]
> Sent:	Sunday, June 17, 2001 7:33 AM
> To:	professional vb
> Subject:	[pro_vb] How to stop a process
> 
> How can I implement the action of a 'Cancel' button?
> 
> Like.. I have a loop itertaing thru a recordset. When the user clicks 
> a 'Cancel' button, the loop should break. 
> 
> Thanks
> 
> Raheem

  Return to Index