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!

Cancel an application once it is started

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I've written some VB code that reads an image filename from a file, opens all the html pages on my hard drive and looks for that image filename inside the html code to see if I need to delete the image. The program works great but takes a good amount of time to run. What I need is to know how to add an "Abort Search" Command Button that the user can click to break out of the loop. Any ideas how? Please Advise!!
 
Hi Tim

Create a form level boolean variable -- CarryOnRunning say

Set the variable to True.

In your loop, check the value of the variable, exit your loop if it is False. Make sure you call DoEvents just before you check the variable.

In a command button on the form -- set CarryOnRunning to False in the Click event.

The DoEvents call will enable you to press the button while things are running. [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top