如果关闭第二个表单,我已经全神贯注地想要关闭程序了
如果第二个表单可见,我有boolean
设置为True,但是当frmCourses.visible检查结束时,我在调试模式An unhandled exception of type 'System.InvalidOperationException' occurred in HomeWork Helper.exe
If Ready Then
If frmCourses.Visible = False Then
Application.Exit()
End If
End if
答案 0 :(得分:1)
在第二个表单中,为Form2_FormClosed
将添加此代码:
Private Sub Form2_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
End Sub
在Sub中,添加Application.Exit()
结果(带注释):
Private Sub Form2_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
'Closes the Application if the 2nd Form is Closed
Application.Exit()
End Sub