How to count items in the listview using c sharp

C# - I want to know how to count all the items in the listview.
Posted by Harpreet 5/4/2014 5:07:53 PM
Total Answers : 1
Answer 1
You can use different methods to achieve this task. Either you can use For loop or you can use the count function. I will show you both the methods :

Method 1 - Foreach loop.
foreach (ListViewItem lvi in listView.Items)
{
//count items here
}

Method - Count Function.
Simply use
ListView1.Items.Count();
Posted by StepCoder Team 5/18/2014 12:24:25 PM
Post your answer
Preview
Sign in to your account
Your Email : 
Password :   
Forgot your password
Don't have StepCoder account ?
Create a new account
 
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
Answer these questions! If you know the answer.