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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.