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)'来显示窗口 - 你能展示代码来证明这个问题吗? –