Consider this VB6 source code
Public bc As Boolean
Dim x As Long
Private Sub Command1_Click()
If bc Then
MsgBox x
Exit Sub
Else
Call exec
End If
End Sub
Private Sub Command2_Click()
bc = True
Call Command1_Click
End Sub
Private Sub Form_Load()
bc = False
End Sub
Public Sub exec()
While 1 = 1
x = x + 10
Label1 = x
DoEvents
Wend
End Sub
now here, i want to stop the execution of a sub-procedure Public Sub exec() which is called by another sub-procedure Private Sub Command1_Click() but without changing or adding any code into Public Sub exec().
Does anyone have an answer?
How to do it?