Hi Hope you can help because its driving me up the wall.
I've made a program that can add 4 items in a row in a list box, for instance
Item Make Guarentee qty Price
toy car rover 1 1 £45.00
monkey monkey 2 1 £65.00
total: £100.00
The problem is I can't get the price to total up in a lable or textbox, however,
I can make it work if i seperate the box and make two, listbox1 for item,make,gtee, qty and listbox 2 for price only.
I don't want this because i want the row to delete in one go instead of deleting it from two boxes which is a time taker. code below
I've worked out how to delete and make it add up right its just the two boxes i cant get my head around.
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim Model As String
Dim Make As String
Dim Guarantee As Integer = 0
Dim price As Double = 0
Dim qty As Integer = 0
Dim Discount As Double = 0
Dim DelCharge As Double = 0
Dim Subtotal As Double = 0
Dim total As Double = 0
Dim totalpayment As Double = 0
'find user input and assign values to their variables
Model = (ModelNotextbox.Text)
Make = (Maketextbox.Text)
Guarantee = Val(Guaranteecombobox.Text)
price = Val(Pricetextbox.Text)
qty = Val(Qtytextbox.Text)
'Price * qty
totalpayment = price * qty
'display data in list box
ListBox1.Items.Add(Model & ControlChars.Tab & ControlChars.Tab & Make & ControlChars.Tab & Guarantee & ControlChars.Tab & qty & ControlChars.Tab)
ListBox2.Items.Add(String.Format("{0:c}", totalpayment))
'Adds list box prices together *
Dim totals As Integer
For Each value As Double In ListBox2.Items
totals += value
Next
Label28.Text = (String.Format("{0:c}", totals))
'Clear previous items
ModelNotextbox.Clear()
Maketextbox.Clear()
Guaranteecombobox.Refresh()
Pricetextbox.Clear()
End Sub
Thanks alot for the help!