Hallo,
wo liegt die Fehler wieso funktioniert der [System.Windows.MessageBox]::Show($DropDown)::OK Befehl in meiner Code nicht??
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
$Form = [System.Windows.Forms.MessageBox]::OK
$Form.width = 300
$Form.height = 150
$Form.Text = ”DropDown”
$DropDown = [System.Windows.MessageBox]::Show($DropDown)::OK
$DropDown.Location = new-object System.Drawing.Size(100,10)
$DropDown.Size = new-object System.Drawing.Size(130,30)
ForEach ($Item in $DropDownArray) {
[void] $DropDown.Items.Add($Item)
}
$Form.Controls.Add($DropDown)
$DropDownLabel = [System.Windows.MessageBox]::Show($DropDown)::OK
$DropDownLabel.Location = new-object System.Drawing.Size(10,10)
$DropDownLabel.size = new-object System.Drawing.Size(100,40)
$DropDownLabel.Text = "Suchen Sie die Pfad aus"
$Form.Controls.Add($DropDownLabel)
$Form.Controls.Add($DropDown)
$DropDownLabel = [System.Windows.MessageBox]::Show($Form)::OK
$DropDownLabel.Location = new-object System.Drawing.Size(10,10)
$DropDownLabel.size = new-object System.Drawing.Size(100,40)
$DropDownLabel.Text = "Zeit"
$Form.Controls.Add($DropDownLabel)
$Button = [System.Windows.MessageBox]::Show($Button)::OK
$Button.Location = new-object System.Drawing.Size(100,50)
$Button.Size = new-object System.Drawing.Size(100,20)
$Button.Text = "Weiter"
$Button.Add_Click({Return-DropDown})
$form.Controls.Add($Button)
$result=[System.Windows.MessageBox]::Show($Form,$Button,$DropDownLabel,$DropDown,[System.Windows.MessageBoxResult]::OK)
return $script:choice