hey guys and gals,

i'm making this program where i am asking if someone is a wholesaler and then making a computation but the compiler is telling me that there is something wrong with the argument "_" after the "MessageBoxButtons.YesNo" part but everything else is fine. below is the regular block of code but below i've got the whole thing.

'ask if the person is a wholesaler
        Dim button As DialogResult

        button = MessageBox.Show("Are you a wholesaler? ", _
        MessageBoxButtons.YesNo, _ MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)

        If button = Windows.Forms.DialogResult.Yes Then
            disc = (qu * prod) * 0.1
            Me.xDiscountLabel.Text = CStr(disc)
        End If

here's the whole thing

Option Explicit On
Option Strict On


Public Class MainForm

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

    Private Sub xCalcButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xCalcButton.Click

        'first variables needed
        Dim qu As Integer
        Dim prod As Double
        Dim total As Double
        Dim disc As Double


        'check to see if any field is empty
        If String.IsNullOrEmpty(Me.xQuantityTextBox.Text) Or String.IsNullOrEmpty(Me.xPriceTextBox.Text) Then
            MessageBox.Show("Please Enter Values in both Quantity and Price Fields. ")
        End If

        'turn entries into numbers
        Integer.TryParse(Me.xQuantityTextBox.Text, qu)
        Double.TryParse(Me.xPriceTextBox.Text, prod)

        'make calc
        total = qu * prod
        Me.xTotalLabel.Text = CStr(total)

        'ask if the person is a wholesaler
        Dim button As DialogResult

        button = MessageBox.Show("Are you a wholesaler? ", _
        MessageBoxButtons.YesNo, _ MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)

        If button = Windows.Forms.DialogResult.Yes Then
            disc = (qu * prod) * 0.1
            Me.xDiscountLabel.Text = CStr(disc)
        End If

    End Sub
End Class

there are not something wrong with _ syntax but the red one is forgotten part :

button = MessageBox.Show("Are you a wholesaler? ", " This is a Caption", _
        MessageBoxButtons.YesNo, _
        MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)

PS : remember to enter after _ syntax.

will try now

it worked. thanx thanx!

you're welcome.
please mark this thread solved.
happy coding friend :)

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.