1
VB and the development of wizards / EStop and Nested Loops
« on: June 16, 2012, 07:12:27 PM »
Is there a better way to handle EStops in a nested loop? I need to stop the loops from running if the EStop is pressed. If I dont once the machine is returned to safe mode the Nested Loop continues to run.
Here is my VB Code:
Sub Main
If IsEStop() Then
Print ("Estop")
Exit Sub
Else
For r = 1 to 3
If IsEStop() Then
Print ("Estop")
Exit Sub
Else
Print "r=" & r
End If
For i = 1 to 10
If IsEStop() Then
Print ("Estop")
Exit Sub
Else
Print "i=" & i
End If
Next i
Next r
End If
End Sub
Here is my VB Code:
Sub Main
If IsEStop() Then
Print ("Estop")
Exit Sub
Else
For r = 1 to 3
If IsEStop() Then
Print ("Estop")
Exit Sub
Else
Print "r=" & r
End If
For i = 1 to 10
If IsEStop() Then
Print ("Estop")
Exit Sub
Else
Print "i=" & i
End If
Next i
Next r
End If
End Sub