Cancel event

I'm looking for a way to kill all processing with a cancel button without exiting the program.  In fact, I'm using a timer to verify a condition and I want to exit the function running...
sstjacquesAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
deightonConnect With a Mentor Commented:
if globalCondition = true then exit function

you need to code this in all the functions you could be in in suitable places, and after function calls so you will drop out of nested function calls back to the form

0
 
Erick37Commented:
Like this;

Private bCancel As Boolean

Private Sub Command1_Click()
    Do
        'Do your processing
        If bCancel Then Exit Do
        DoEvents
    Loop 'Until ...
End Sub

Private Sub Command2_Click()
    'Stop the processing
    bCancel = True
End Sub
0
All Courses

From novice to tech pro — start learning today.