Binglee2323 Binglee2323 - 2 months ago 5x Question

Confirming program close with a messagebox

I have a message box that pops up when i press a close button that basicaly says" Are you sure you want to quit" but when i click the no button or cancel but the program closes any how

this is my code:

'Close Button
Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnClose.Click

Dim result = MessageBox.Show(" Are you sure you want to quit", "Are you sure?", MessageBoxButtons.YesNoCancel)

End Sub


You are doing nothing with the value of result. You need to inspect the value and determine whether you call Me.Close(). Code approximately

If result = DialogResult.Yes Then
End If