Msg box (Yes key need double click to close)

  • Thread starter Thread starter meeraluv
  • Start date Start date
M

meeraluv

Guest
Why my Yes Button need double click to close and No button only require 1 click... I need both 1 click only.. What i am missing here? Please help


Private Sub Form1_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Try
Dim result As Integer
result = MessageBox.Show("Are you want to close", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.None)
If (result = DialogResult.No) Then
e.Cancel = True
Else
file.WriteLine(Now() & " " & "Succesfully closed the Application")
file.Flush()
Application.Exit()
Environment.Exit(Environment.ExitCode)

End If
Catch ex As Exception
file.WriteLine(ex.Message)
End Try
file.Flush()
End Sub

Continue reading...
 
Back
Top