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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pause a Process

Status
Not open for further replies.

JTBorton

Technical User
Jun 9, 2008
345
DE
I know that I can use DoEvents to allow the user to cancel a process or loop, but is it possible to pause the loop or process dead in its tracks until the user chooses to resume?

Code:
For Each itmTag In lvwTagList.ListItems
     DoEvents
     If blnCancel = True Then: GoTo Proc_exit
     [Do Stuff]
Next itmTag

-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
 
insert a message box

Code:
Msgbox "This Process Has Been Paused!" & VBcrlf & "Click OK to resume"
 
Sure - one way is to just pop a message box into the loop:
Code:
For Each itmTag In lvwTagList.ListItems
     DoEvents
     If blnCancel = True Then: GoTo Proc_exit
     if blnPause = true then
         if MsgBox("Continue?", vbYesNo, "Continue") = vbYes then
           blnPause = false
         else
           goto proc_exit
         end if
     end if
     [Do Stuff]
Next itmTag

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Oh wow, that's simple. Thanks guys.

-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top