Results 1 to 3 of 3

Thread: [RESOLVED] How to interrupt a method from a user form control?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2009
    Posts
    17

    Resolved [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

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    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.



  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2009
    Posts
    17

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width