Hey all,

I am trying to display a message asking if the user is sure that they want to close just before closing.

Here's what I've got...and it's only telling me that there's something wrong with the word "Message" after the MessageBox.Show part

Private Sub xExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExitButton.Click

        Dim button As DialogResult

        button = MessageBox.Show(Message, _
        "Are you sure you want to exit this application?", _
        MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button1)

        If button = Windows.Forms.DialogResult.Yes Then
            Me.Close()
        Else
        End If


    End Sub

Help?...Anyone?

i was modified your code.
your messagebox parameter is not completed, that why errors coming out.

Private Sub xExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles xExitButton.Click

        Dim button As DialogResult

        button = MessageBox.Show _
        ("Are you sure you want to exit this application?", _
        "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)

        If button = Windows.Forms.DialogResult.Yes Then
            Me.Close()
        Else
        End If
    End Sub

btw this thread for vb.net question not for vb6...

Comments
Yupy
Good

btw this thread for vb.net question not for vb6...

thank you very much. and i'm sorry i didn't ask the question in the right place. where should i direct my VB6 questions to?

you can post all vb question in this section(vb6) but just for vb.net question like this thread please post on vb.net section.
and don't forget to mark this thread solved.
Happy coding friend :)

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