VB Code:
Private Sub frmInventory_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed Dim yesToUpdate As Integer If changes Then yesToUpdate = MsgBox("Changes made are not save, do you want to save the changes ?", MsgBoxStyle.DefaultButton1 + MsgBoxStyle.YesNoCancel, "Save Changes") If yesToUpdate = vbYes Then MsgBox("update") ElseIf yesToUpdate = vbCancel Then MsgBox("Close the msgbox,but not close the form") End If changes = False End If cnn.Close() End Sub
What I want is if I click the "Cancel" button of he message box, I dont want the form to be closed. Only "Yes" and "No" will close the form.
Any idea how to achieve that?




Reply With Quote