所以这是我下面的代码。当我单击表单上的 X 按钮时,消息框会显示并单击无效,但是当我单击是时,消息框会关闭并再次快速出现,然后第二次单击任一按钮将关闭表单。它出什么问题了?
Private Sub Config_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Dim result = MessageBox.Show("Would you like to quit?", MessageBoxButtons.YesNo)
If result = DialogResult.No Then
e.Cancel = True
ElseIf result = DialogResult.Yes Then
Application.Exit()
End If
End Sub
提前致谢