i have an mdi form. always display this error on closing. i have this code on its closing button

Private Sub mdiprfct_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If MessageBox.Show("Are you sure want to quit?   ", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.No Then
            e.Cancel = True

        End If
    End Sub

i dont know im getting this error i attach img of its error

Attachments lmno.jpg 27.04 KB

I hope it will help you

Private Sub mdiprfct_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing

   Dim confirmation As String

        confirmation = MsgBox("Exit System?", MsgBoxStyle.YesNo, "CONFIRMATION")

        If confirmation = vbNo Then
           e.Cancel = True
        ElseIf confirmation = vbYes Then
           MsgBox("TO GOD ALL THE HONOR, PRAISE AND GLORY ", MsgBoxStyle.Information, "GOD BLESS US")
            Me.Dispose()
        End If
     
    End Sub

I hope it will help you

Private Sub mdiprfct_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing

   Dim confirmation As String

        confirmation = MsgBox("Exit System?", MsgBoxStyle.YesNo, "CONFIRMATION")

        If confirmation = vbNo Then
           e.Cancel = True
        ElseIf confirmation = vbYes Then
           MsgBox("TO GOD ALL THE HONOR, PRAISE AND GLORY ", MsgBoxStyle.Information, "GOD BLESS US")
            Me.Dispose()
        End If
End Sub

it helps a lot thank you sir.... if you wont mind can i send you email.
hope its ok sir.

Edited 4 Years Ago by shann1718: n/a

This question has already been answered. Start a new discussion instead.