I'd like to add a Cancel button to a form whereby I could interrupt a certain program task, typically a time-consuming one, for example:

for i1=1 to largeNumber1
for i2=1 to LargeNumber2
WorkOnSomethingCumbersome
next
next

How can I have the cancel button take me out of the loops and to the exit point of the procedure?