除了我的主窗体之外,我还有另一个窗体 frmAddFixture,它可以打开 frmAddReport。
当从 msgbox 中选择“否”时,我只是试图关闭 frmAddFixture,这也关闭(成功)我(frmAddReport)。如果选择“是”,frmAddFixture 应该保持打开状态,它确实如此。但我不能让它关闭“不”。我尝试添加我自己的处理程序来检测 frmAddReport 何时关闭,但我无法让它工作。
frmAddReport 代码(在单击“提交”按钮后运行):
Private Sub showMsg()
Select Case MsgBox("Do you want to add another player report for this fixture?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Add further reports")
Case MsgBoxResult.Yes
isNewFixture = False
Me.Close()
Case MsgBoxResult.No
isNewFixture = True
Me.Close()
''Close frmAddFixture
'frmAddFixture.Dispose()
'frmAddFixture.Close()
'frmAddFixture.Hide()
End Select
End Sub
尝试:
Private Sub frmAddReport_FormClosed(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.FormClosed
frmAddFixture.Dispose()
End Sub