Unable to cancel form while it's running

Welcome Forums General PowerShell Q&A Unable to cancel form while it's running

This topic contains 1 reply, has 2 voices, and was last updated by

11 months, 2 weeks ago.

  • Author
  • #95856

    Points: 1
    Rank: Member

    I have a PowersShell form that has a start button with a few functions:


    While the script is calling the functions in the background, I am unable to interact with GUI. More specifically, I am unable to click on the cancel button to cancel/exit the script at anytime. The only time I can cancel the form is when it is completely finished running all the functions. Are there any ways to keep my start button active and cancel my form at any time?

  • #95859

    Points: 14
    Rank: Member

    What you are looking for is a multi-threaded application. There's some ways of doing that, see link below.
    Part V – Building Responsive PowerShell Apps with Progress bars

    Stephen Owen wrote the above blog. It's really useful in describing how to use multiple runspaces in your application. I won't lie though, even after reading the blog, it took me a little while to fully grasp the concept and apply it myself.

The topic ‘Unable to cancel form while it's running’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort