I am learning Powershell and attempting to create a GUI interface like the example here.
However, when I run this as it is, $x
is never defined. Any idea what I could be doing wrong? I know it has something to do with:
$OKButton.Add_Click({$x=$objListBox.SelectedItem;$objForm.Close()})
Because if I change it to:
$OKButton.Add_Click({Write-Host "worked";$objForm.Close()})
It does return worked
.