So this is my code below. When I click the X button on the form, the message box shows and clicking no works but when I click yes, the message box closes and comes up again quickly and then the second time, clicking either button will close the form. What's wrong with it?
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
Thanks in advance