-
Hello!
In my app I'm using a rather slow loop, which takes a lot of time. I'm using a form with a progressbar to show how much time it's left, but I would like to have a commandbutton which the user could press to abort the loop -a cancel button.
I'm not sure how to do this, since pressing a button triggers a new event, and my app is bussy carriyng out the event with the loop.
If you know how to do this, please help me!
Pentax
-
-
Yo
Look at this old loop for your anwser
-
Just thought I'd give an alternative that's similar in concept: this one shows a loop displaying a countdown and stops when the user hits escape
Code:
Option Explicit
Dim lCntr As Long
Private Sub Command1_Click()
lCntr = 100000
Do While lCntr > 0
lCntr = lCntr - 1
Label1 = lCntr
DoEvents
Loop
End Sub
Private Sub Command2_Click()
lCntr = 0
End Sub