PS Form not Running as Expected

hello…

Just started to use PowerShell Pro Tools for VS.

I have created a form with a number of cmdlets such as Get-ADuser, Get-AdGroup and Get-AdGroupmembers, the issue is when I run it away from visual stuido, within VS it all runs fine, away from VS either running the .ps1 files or using an .exe I complied. The form loads but nothing works the onload functions don’t run and buttons don’t do anything…

I can run the code in the ise fine, but I would either like a .exe or just the scrip to run as its tools yo help other users…

Any advice would be grateful…

Thank you.
Karl

Turns out my designer file should be at the bottom and not the top as I had it…

So all buttons and on form loads work now…