hello im creating a form application and i ran into a problem. I have 2 buttons 1 Order button and 1 Checkout Button. I also have 2 Listboxes, one for your order and the last one for your invoice. My problem is when i get to the second listbox. i get all the data over to there that i want however i need to change the extendedprice to an updated price from a discount. I also have 3 radio buttons for different discounts. when i click a radio button and hit the checkout button i cannot seem to get the discount to show up when i run it just stops at regular extended price in my second list box. any help would be very gratefull as i am still new to this but im trying to learn
Public Class Form1
Private Sub btnorder_Click(sender As Object, e As EventArgs) Handles btnorder.Click
Dim itemnumber As Decimal
Dim price As Decimal
Dim extendedprice As Decimal
Dim quantity As Decimal
itemnumber = txtitemnumber.Text
quantity = txtquantity.Text
extendedprice = price * quantity
If itemnumber = 100 Then
extendedprice = 3.5 * quantity
listorder.Items.Add("Item Number: 100")
listorder.Items.Add("Description: Wrench")
listorder.Items.Add("Quantity:" & quantity)
listorder.Items.Add("Price: $3.50")
listorder.Items.Add("Extended Price:" & extendedprice.ToString("c"))
End If
If itemnumber = 200 Then
extendedprice = 5.75 * quantity
listorder.Items.Add("Item Number: 200")
listorder.Items.Add("Description: Pipe Wrench")
listorder.Items.Add("Quantity:" & quantity)
listorder.Items.Add("Price: $5.75")
listorder.Items.Add("Extended Price:" & extendedprice.ToString("c"))
End If
If itemnumber = 300 Then
extendedprice = 16.23 * quantity
listorder.Items.Add("Item Number: 300")
listorder.Items.Add("Description: Rip Saw")
listorder.Items.Add("Quantity:" & quantity)
listorder.Items.Add("Price: $16.23")
listorder.Items.Add("Extended Price:" & extendedprice.ToString("c"))
End If
If itemnumber = 400 Then
extendedprice = 32.5 * quantity
listorder.Items.Add("Item Number: 400")
listorder.Items.Add("Description: Framing Hammer")
listorder.Items.Add("Quantity:" & quantity)
listorder.Items.Add("Price: $32.50")
listorder.Items.Add("Extended Price:" & extendedprice.ToString("c"))
End If
If itemnumber = 500 Then
extendedprice = 27.5 * quantity
listorder.Items.Add("Item Number: 500")
listorder.Items.Add("Description: Square")
listorder.Items.Add("Quantity:" & quantity)
listorder.Items.Add("Price: $27.50")
listorder.Items.Add("Extended Price:" & extendedprice.ToString("c"))
End If
If itemnumber = 600 Then
extendedprice = 6.34 * quantity
listorder.Items.Add("Item Number: 600")
listorder.Items.Add("Description: Solder")
listorder.Items.Add("Quantity:" & quantity)
listorder.Items.Add("Price: $6.34")
listorder.Items.Add("Extended Price:" & extendedprice.ToString("c"))
End If
If itemnumber = 700 Then
extendedprice = 4.26 * quantity
listorder.Items.Add("Item Number: 700")
listorder.Items.Add("Description: Paste")
listorder.Items.Add("Quantity:" & quantity)
listorder.Items.Add("Price: $4.26")
listorder.Items.Add("Extended Price:" & extendedprice.ToString("c"))
End If
If itemnumber = 800 Then
extendedprice = 11.77 * quantity
listorder.Items.Add("Item Number: 800")
listorder.Items.Add("Description: Screwdriver")
listorder.Items.Add("Quantity:" & quantity)
listorder.Items.Add("Price: $11.77")
listorder.Items.Add("Extended Price:" & extendedprice.ToString("c"))
End If
End Sub
Private Sub btncheckout_Click(sender As Object, e As EventArgs) Handles btncheckout.Click
Dim discount As Decimal
Dim totalprice As Decimal
Dim extendedprice As Decimal
discount = extendedprice - discount
totalprice = extendedprice * discount
listinvoice.Items.Add(" Timber Tom’s Hardware 2016-10-11 6:30 pm")
listinvoice.Items.AddRange(listorder.Items)
If rbnodiscount.Checked Then
listinvoice.Items.Add("No Discount")
End If
If rb10discount.Checked Then
discount = extendedprice * 0.1
extendedprice = extendedprice - discount
listinvoice.Items.Add("Discount: " & discount.ToString("c"))
listinvoice.Items.Add("Total Price: " & totalprice.ToString("c"))
End If
If rb15discount.Checked Then
discount = extendedprice * 0.15
extendedprice = extendedprice - discount
listinvoice.Items.Add("Discount: " & discount.ToString("c"))
listinvoice.Items.Add("Total Price: " & totalprice.ToString("c"))
End If
End Sub
End Class