I found am example of how to return a value from a Windows form and believe there is a bug or I just don't understand how it should work... The specific line that doesn't work for me is this:
In this example they set $X to a value from the Text box, and at the end of the script they output the text that was entered as part of the $ObjTextbox object. The output of $X never happens for me. The only way I have gotten this to work is to change $X to $Global:X... Is the example wrong, or is there something I am missing.
$OKButton.Add_Click({$x=$objTextBox.Text;$objForm.Close()})
I got the example from here:
http://technet.microsoft.com/en-us/library/ff730941.aspx