Mein naiver Ansatz:
# unchanged code here #1 $button1 = New-Object System.Windows.Forms.Button $button1.Location = New-Object System.Drawing.Size(125,120) $button1.Size = New-Object System.Drawing.Size(100,50) $button1.Text = "1" $button1.Name = "1" $button1.Add_Click({$Textfeld.Text+='1'}) $Taschenrechner.Controls.Add($button1) # change #2 .. #9 analogously to #1 and #0 #0 $button0 = New-Object System.Windows.Forms.Button $button0.Location = New-Object System.Drawing.Size(125,270) $button0.Size = New-Object System.Drawing.Size(100,50) $button0.Text = "0" $button0.Name = "0" $button0.Add_Click({$Textfeld.Text+='0'}) $Taschenrechner.Controls.Add($button0) # unchanged code here