[RESOLVED] How to interrupt a method from a user form control?
Hi,
I have a class module that basically controls a motor to open/close a trap. I defined the open and close methods. The methods simply turn on (of off) the motor and monitor the closure of a limit switch to stop motion. As with any mechanical system, things can and will go wrong and I have a panic stop button on the main user form to freeze the motor in order to prevent an accident or simply get out of the method if the switch is defective.
I do not know how to make the method recognize the fact that the form button has been pressed. I suspect it has to do with a "with event" declaration but am not sure how to incorporate this.
Any help would be welcome.
Thanks
Olivier
Re: How to interrupt a method from a user form control?
If i understood well, you can add a public boolean property name it e.g. ButtonPressed, when the form button pressed set it to True and in your method check the state of ButtonPressed property.
Re: How to interrupt a method from a user form control?
Hi,
Thanks for the quick reply. I tried that and it did not work initially but after adding a DoEvents in my motion loop, it worked like a charm.
Thanks again
Olivier