Quantcast
Channel: SAPIEN Forums
Viewing all articles
Browse latest Browse all 311

PowerShell GUIs • Cut & Paste of buttons make them not work

$
0
0
I recently created a Form in PowerShell Studio 2024 that included a tabcontrol and each tab had its own series of buttons and textboxes and everything worked as expected. Based on feedback from my colleagues, I had to re-design the form a little, and rather than starting from scratch, I just did a Save As and saved it to a new form to play around with some changes. I ended up doing a Cut & Paste of the textboxes and buttons from several tabs and created new groupbox controls and placed them there. Now when I test it within the PS Studio, or export it to a .ps1 and run it, most of my buttons don't work. Last night I was able to remove a button and recreate it, and that made the button work again. I compared an export of the form with the newly re-created button and realized that PS Studio either removed, or is not adding the "$button1.add_Click($button1_Click)" lines for most of the buttons in the exported .ps1 file. This morning I spent about an hour and a half documenting each button, and then removing it and re-adding them all, but again when I ran it from PS Studio most of the buttons did not work. After doing another export, I see that the line is still missing from the code for the buttons. If I manually edit the .ps1 file and add the lines, the buttons work as expected.

So my question is how do I get PS Studio to automatically add these lines back? I still have a lot of updates to do for this form, and I'd prefer to be able to export it and then just copy the updated code to the production script, so manually adding these lines into the script each time really isn't a viable option.

Product: PowerShell Studio 2024 (64 Bit)
Build: v5.8.237
OS: Windows 11.0.22621
PS Version(s): 5.1.22621.1, 7.4.1

Statistics: Posted by jason_vianco — Wed Mar 27, 2024 8:01 am — Replies 2 — Views 33



Viewing all articles
Browse latest Browse all 311

Trending Articles