- May 27, 2016 at 4:59 pm #40696
I am attempting to make a GUI that our Help Desk can utilize when deploying newly imaged machines. I apologize if this is a stupid question but I'm stumped.
I am using ISE Steroids/Visual Studio to create it and am fairly confident I know what the issue is but I'm not entirely sure how to resolve the problem.
When I run it on my computer it works fine but when I go to run the script or converted EXE on another machine I receive an error..
You cannot call a method on a null-valued expression. At C:\Users\bb16480\Desktop\UItest.ps1:73 char:1 + $SEP.add_Click( + ~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) , RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
I couldn't get the code to load the $XAML in here so I put it in pastebin at: http://pastebin.com/MT1HvKxpMay 27, 2016 at 5:21 pm #40706
Well, it's thinking that $SEP doesn't actually contain anything. I'm not seeing that in your code, though. It seems as if you expect $SEP to be a form object...?
BTW, you can also use Gists here. If you paste the Gist URL into the forums, it'll retrieve and display your code all pretty-like.May 27, 2016 at 5:32 pm #40708
Sorry, I believe I was testing something else but that didn't work and I put in the incorrect error. 🙁
It's not $Sep it's $Windows.SEP
You cannot call a method on a null-valued expression. At C:\Users\bb16480\Desktop\UItest.ps1:73 char:22 + $window.SEP.add_Click < <<< ( + CategoryInfo : InvalidOperation: (add_Click:String) , RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
This does run on my Win10 machine with ISE-Steroids but when I try to run this script on our normal Win7 client machines, this is when the error comes up. The GUI does popup but I still receive the error code.
Hopefully that makes sense. I'm trying hard to wrap my head around all this. Also thanks for the tremendous sessions @MMS this year, it was fantastic.May 27, 2016 at 5:38 pm #40710
I don't see the rest of the code that creates the form at that link.May 27, 2016 at 5:42 pm #40712
Hopefully this helps for viewing?May 27, 2016 at 5:43 pm #40714
The form works for me on win7.
[System.Object]$sender = $args
[System.Windows.RoutedEventArgs]$e = $args
write-host 'sep clicked'
)May 27, 2016 at 6:03 pm #40722
Oy.... well it turns out it was something with the VM I was testing this on that caused an issue.
Appreciate you checking it out and sorry about that. I was kind of banging my head on the wall the past hour or so in between some other work and it turns out it was fine after all.
Uffta....July 25, 2016 at 8:19 pm #48216
Did you have any luck with figuring this out?
I am seeing the same issue on a vista machine. I believe its due to something not being up to date, but Im not sure what.
You must be logged in to reply to this topic.