Reputation: 556
I'm having a problem with my form in VB.net. I want to remain my form open when I clicked no in the decision box.
this is my code:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If (MsgBox("Do you want to quit now?", MsgBoxStyle.YesNo).ToString = "Yes") Then
Dim login As New login
login.Show()
Else
'remain my form
End If
End Sub
Please help me. thankyou.
Upvotes: 0
Views: 37
Reputation: 2060
You should set the Cancel property of the e parameter to True.
e.Cancel = True
For more info, check the Form.FormClosing (or Form.Closing) event.
Upvotes: 1