Powershell GUI – Function outsourcing

Welcome Forums General PowerShell Q&A Powershell GUI – Function outsourcing

Viewing 0 reply threads
  • Author
    Posts
    • #255830
      Participant
      Topics: 1
      Replies: 0
      Points: 11
      Rank: Member

      Dear forum,
      I have an issue, which I hope, you guys can help me with:
      I am having a window, named “$objForm”

      in which I have implemented a button (called $btn5). By pushing this button, a function (called done) shall be opened, which generates a “close/done-button” to this form (This works fine, as long, as the code is not outsourced as a function)

      in the main window, I have set

      to call the function (when pushing the button), I have

       

      The function looks like this :

      When running the program (the main window), and pushing the button, I get the following:

       

      What I do not understand is: Why can I do a ==> write-Host $WindowName <== in the function
      But a ==> $WindowName.Controls.Add($done) <== does not work in the function?

       

      Thank you very much for any help
      newbi

      • This topic was modified 1 week, 2 days ago by newbi200925.
      • This topic was modified 1 week, 2 days ago by newbi200925.
      • This topic was modified 5 days, 22 hours ago by grokkit.
Viewing 0 reply threads
  • You must be logged in to reply to this topic.