Click here to Skip to main content
16,018,417 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have An Listview

SrNo ItemName
1 a1
2 a2
3 a3
4 a4
5 a1
6 a2
7 a1
8 a3
9 a1
10 a1

how to get

Item Name| TotalCount
A1 | 5
a2 | 2
a3 | 2
a4 | 1

in vb.net
Posted
Comments
King Fisher 17-Apr-14 8:05am    
you getting this value from database?

You may use a Dictionary<String,Integer> for the purpose. Where the String represents the item and the Integer represent how many times the item occurred in the ListView. In a single iteration you can populate the Dictionary: if the item is already present you just increment the Integer value, on the other hand, if the item doesn't yet exist in the Dictionary, then you add it and set the Integer to 0.
 
Share this answer
 
v2
use this code..

VB
dim l as integer
l =  listview1.Items.Count
msgbox(l)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900