This is my code

Dim dblPrice As Double = 0

        Dim dblTotal As Double = 0
        Dim strTotal As String


        dblPrice = CDbl(txtPrice.Text)
        intQuantity = CInt(txtQuantity.Text)

        dblTotal = (dblPrice * intQuantity)
        strTotal = Format(dblTotal.ToString("N2"))

        If chkDessert.Checked = True Then
            strTotal += 5

        End If

        If chkDrink.Checked = True Then
            strTotal += 2
        End If

        If rbtnDine.Checked = True Then
            strTotal += (strTotal * 0.1)
            MessageBox.Show("Table Number : " & txtNumber.Text & vbCrLf & "Total Bill : RM" & strTotal & "", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information)

        End If

        If rbtnTake.Checked = True Then
            strTotal += (strTotal * 0.05)
            MessageBox.Show("Take Away" & vbCrLf & "Total Bill : RM" & strTotal & "", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information)

        End If

This code run nicely but the answer not get as two decimal places like what i want.. anybody can help me ?

Dim dblTotal As Double = 123123 * 0.05

MessageBox.Show(dblTotal.ToString("N2"))

'i do a simple version for that, it goes this way
'assume that you want to view your answer in text1

text1.txt = formatnumber (Val(text3.text) + Val(text2.text))

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.