Bold Eagle 0 Newbie Poster

I have a listview with multiable items. All items have the following columns saleman, company, part, qty, price. Now I'ming pulling each items from a combobox and calculate price. I would like to get any/all items that have been adding more than once, which happens because some part have been combind as one part #, but is still listed as old numbers.

Here is a copy of the code I have started.

Private Sub Sum_Amt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sum_Amt.Click
        Dim str(3) As String
        Dim comsum As Double
        Dim compct As Double
        Dim rc As Integer = Me.CA_View.Items.Count
        Dim ii, i As Integer
        Dim strItem As String = (Me.CA_View.Items.Item(i).SubItems.Item(4).Text)
        MsgBox(rc)
        listitem = New ListViewItem

        For i = 0 To rc - 1
            comsum += (Me.CA_View.Items.Item(i).SubItems.Item(1).Text)
            compct += (Me.CA_View.Items.Item(i).SubItems.Item(2).Text)
            str(0) = Me.CB_Job1.Text
            str(1) = Me.RepNo1.Text
            str(2) = comsum
            str(3) = compct
            ListView11.Visible = True
            
        Next 'i

        listitem = New ListViewItem(str)
        Me.ListView11.Items.Add(listitem)
        If rc <> 0 Then

            i = 0
            Do  'For i = 0 To rc - 1
                comsum = 0
                compct = 0

                ListView11.Items.Clear()
                ListView11.Visible = True

                ii = 1
                Do
                    If Me.CA_View.Items.Item(i).SubItems.Item(4).Text = ListView11.Items(ii).SubItems.Item(1).Text Then
                        comsum += CDbl((Me.CA_View.Items.Item(i).SubItems.Item(1).Text))
                        compct += CDbl((Me.CA_View.Items.Item(i).SubItems.Item(2).Text))
                        MsgBox(rc)
                        str(0) = Me.CB_Job1.Text
                        str(1) = Me.RepNo1.Text
                        str(2) = comsum
                        str(3) = compct
                        ListView11.Visible = True
                       
                    End If
                    If Me.CA_View.Items.Item(i).SubItems.Item(4).Text <> ListView11.Items(ii).SubItems.Item(1).Text Then
                        comsum += CDbl((Me.CA_View.Items.Item(i).SubItems.Item(1).Text))
                        compct += CDbl((Me.CA_View.Items.Item(i).SubItems.Item(2).Text))
                        str(0) = Me.CB_Job1.Text
                        str(1) = Me.RepNo1.Text
                        str(2) = comsum
                        str(3) = compct
                        ListView11.Visible = True

                    End If
                    
                    ii += 1
                Loop Until ii = Me.CA_View.Items.Count

                i += 1

            Loop Until i = Me.CA_View.Items.Count

        End If

        listitem = New ListViewItem(str)
        Me.ListView11.Items.Add(listitem)
    End Sub
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.