Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i want to count rows in list view where 3rd column value is 'Check'. If listview contains only one row then message box should be shown "only one row exists".
Posted
Comments
OriginalGriff 9-Jun-13 14:13pm    
If you are waiting for permission, then consider it given.
Otherwise, what have you tried? Where are you stuck?

Refer - Counting Rows In A ListView Where There Are Specific Values[^].

The answer suggests to use linq to check the value of a column and count number of rows accordingly.

Please follow and try that out.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Jun-13 15:43pm    
Sure, a 5.
—SA
Thanks a lot Sergey Alexandrovich Kryukov... :)
To get count of ListView items count, use:
C#
Label1.Text = ListView1.Items.Count();

ListView Class[^]
ListView Properties[^]
ListView.Items property[^

But if you want to get count of "checked" items, use ListView.SelectedItems property[^] or Listview.CheckedItems property[^] depending of your needs.
 
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