Public Class Form1
Private Sub btnCompute_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCompute.Click
Dim pizza, fries, drinks As Double
' inputs by customer
pizza = CDbl(txtPizza.Text)
fries = CDbl(txtFries.Text)
drinks = CDbl(txtDrinks.Text)
displayBill(pizza, fries, drinks)
End Sub
Sub displayBill(ByVal num1 As Double, ByVal num2 As Double, ByVal num3 As Double)
Dim sum As Double
Dim calnum1, calnum2, calnum3 As Double
Dim fmtstr As String = "{0, -15} {1, 17:n} {2,19:c2}"
'calculation for number of item ordered
calnum1 = txtPizza.Text + num1
calnum2 = num2 + txtFries.Text
calnum3 = num3 + txtDrinks.Text
'Price of each food item
num1 = 1.75
num2 = 2.0
num3 = 1.25
sum = calnum1 + calnum2 + calnum3
'list of products view
lstResult1.Items.Clear()
lstResult1.Items.Add(String.Format(fmtstr, "Item: ", "Quantity", "Price"))
lstResult1.Items.Add(String.Format(fmtstr, "Pizza Slices", txtPizza.Text, num1))
lstResult1.Items.Add(String.Format(fmtstr, "Fries", txtFries.Text, num2))
lstResult1.Items.Add(String.Format(fmtstr, "Soft Drinks", txtDrinks.Text, num3))
lstResult1.Items.Add(String.Format(fmtstr, "", "", ""))
lstResult1.Items.Add(String.Format(fmtstr, "Total :", "", sum))
End Sub
End Class
thanks in advance
MOMO