Hello Guys.. Need help again with this code :(
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Name As String
Dim Visits, Calls As Integer
Dim Sales As Long
Visits = 0
Calls = 0
Sales = 0
'I want to store all the lvAccountManager Column 1 a string called "Name"
For Each itm As ListViewItem In Me.lvAccountManager.Items
Name = itm.SubItems(1).Text
Next
'if the "Name" has a value they will find it in Listview1
'It will add all the Columns 3 if they are part of the "Name"
For Each Itm As ListViewItem In ListView1.Items
If Itm.SubItems(1).Text = Name Then
Visits += Val(Itm.SubItems(2).Text)
Calls += Val(Itm.SubItems(3).Text)
End If
Next
'Same goes here *Take note its also a different listview.
For Each Itm As ListViewItem In lv.Items
If Itm.SubItems(2).Text = Name Then
Sales += Val(Itm.SubItems(9).Text)
End If
Next
'The result will be like this
will be added to a new listview...
For Each Total As Totals In Activity
Me.ListView2.Items.Add(Total.Name, Total.Name, 0)
Me.ListView2.Items(Total.Name).SubItems.Add(Str(Total.AverageSales))
Me.ListView2.Items(Total.Name).SubItems.Add(Str(Total.Calls))
Me.ListView2.Items(Total.Name).SubItems.Add(Str(Total.Visits))
Next
End Sub
This is the example Output
Imagine this is a listview Lol
___________________________________
/ Name / Sales / Calls / Visits /
/ Sample / 1000 / 20 / 10 /
/ Sample2 / 20 / 15 / 8 /
Please help me :(