0
我試圖執行exit
單擊「否」按鈕時,請關閉後的形式,但exit
導致系統錯誤出口導致未處理的異常
代碼:
function No {
$Form.close()
exit
}
$NoButton.Add_Click({No})
沒有退出,它關閉的形式,但它繼續執行腳本
系統錯誤:
Unhandled exception has occured in a component in your application. If you click Continue, the application will ignore this error and attempt to continue.
System error.
全部按鈕代碼:
function No {
$Form.close()
exit
} #end No
# No button
$NoButton = New-Object System.Windows.Forms.Button
$NoButton.Location = New-Object System.Drawing.Size(95,80)
$NoButton.Size = New-Object System.Drawing.Size(80,20)
$NoButton.Text = "No"
$NoButton.Add_Click({No})
$NoButton.Cursor = [System.Windows.Forms.Cursors]::Hand
$Form.Controls.Add($NoButton)
使用'[系統時,我無法重現此錯誤。 Windows.Forms.Application] :: Run($ Form)'來顯示窗口 - 你能展示代碼來證明這個問題嗎? –