Question
I want to create a modeless dialog box that will start a loop which will run until a "Cancel" button is clicked.
Answer
The code below demonstrates a working loop that will be stopped by pressing the "Cancel" button. Please note because of the way the loop works the user may need to press the "Cancel" button twice. It is also important to notice that the EventInvoke property of the Cancel button is set to 0 - Keep Focus. If it's not set to this, the event will not be fired until after the loop is finished.
Knowledge Base
FAQ