Jake.20 0 Junior Poster in Training

I need help ... again. I'm having so much problem in here, on how to multiply column 0 to column to which is.

The column 0 is the quantity, and the column 2 is the price.

I have a pizza hut Ordering system. Here is my problem. After i click the image, it will ask the quantity of the pizza, and then click the price.

for example:
the pizza's normal price is 255.00

Qty = 5
price = 1,275


At first it was ok, but when i add another item with the same qty, and also the same normal price. it went wrong. The price of the 2nd item was 6,375. It multiplied the same price and qty of the first item.


here is my code.

With ListView1
            If Not .SelectedItems.Count = 0 Then
                If RadioButton1.Checked = True Then

                    Dim qnty As Integer
                    .SelectedItems(0).SubItems(2).Text = FormatCurrency((105.0), 2, True, True, True)
                    qnty = ListView1.Items(0).Text * ListView1.Items(0).SubItems(2).Text
                    ListView1.SelectedItems(0).SubItems(2).Text = qnty
                    '// change .Text of .SubItem.
                    '// .SubItems(1) = column 2, .SubItems(2) = column 3, etc..
                    ' PriceTF.Text = Val(PriceTF.Text) & 105.0
                End If

                If RadioButton2.Checked = True Then

                    Dim qnty2 As Integer
                    .SelectedItems(0).SubItems(2).Text = FormatCurrency((255.0), 2, True, True, True)
                    qnty2 = ListView1.Items(0).Text * ListView1.Items(0).SubItems(2).Text
                    ListView1.SelectedItems(0).SubItems(2).Text = qnty2
                    '// change .Text of .SubItem.
                    '// .SubItems(1) = column 2, .SubItems(2) = column 3, etc..
                End If

                If RadioButton3.Checked = True Then

                    Dim qnty As Integer
                    .SelectedItems(0).SubItems(2).Text = FormatCurrency((399.0), 2, True, True, True)
                    qnty = ListView1.Items(0).Text * ListView1.Items(0).SubItems(2).Text
                    '// change .Text of .SubItem.
                    '// .SubItems(1) = column 2, .SubItems(2) = column 3, etc..
                End If

                If RadioButton4.Checked = True Then

                    Dim qnty As Integer
                    .SelectedItems(0).SubItems(2).Text = FormatCurrency((105.0), 2, True, True, True)
                    qnty = ListView1.Items(0).Text * ListView1.Items(0).SubItems(2).Text
                    '// change .Text of .SubItem.
                    '// .SubItems(1) = column 2, .SubItems(2) = column 3, etc..
                End If
            End If
            Dim dTotal As Double = 0 '// for adding total.
            For Each itm As ListViewItem In ListView1.Items '// loop thru items.
                With itm.SubItems(2) '// shorten code for Column 2 items.
                    '// check if Not Nothing, add to total.
                    If Not .Text = Nothing Then dTotal += CDbl(.Text) '// converting currency to Double will remove the $ symbol.
                End With
            Next
            TotalValueTF.Text = (CDbl(dTotal).ToString("c"))

        End With
    End Sub

Need help guys. Thank you in advance.

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.