Schließen eines Formulars abfangen

Private Sub frmMain_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
    Dim strMeldung As String = "Wollen Sie die Anwendung beenden?"
    Dim dr As DialogResult = MessageBox.Show(strMeldung, My.Application.Info.Title, MessageBoxButtons.YesNo)

    If dr = Windows.Forms.DialogResult.Yes Then
        e.Cancel = False
    Else
        e.Cancel = True
    End If
End Sub