• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2561
  • Last Modified:

Count the number of items in a listbox using C#

Let me say this upfront - I'm extremely new to using C# so bare with me.
I have simpe app that allows the user to select a folder and renames all the files within that folder. I've got it now to show in a listbox the files within that folder before and after the rename. Now I want to show the total number of files in the folder somewhere in the app.
So they no they've renamed them all. i.e. "Total Files: 122"
How the heck do you do that?
Thanks for the lesson
0
DFCRJ
Asked:
DFCRJ
  • 2
1 Solution
 
Bob LearnedCommented:
this.Label1.Text = "Total Files: " + this.ListBox1.Items.Count;

Bob
0
 
DFCRJAuthor Commented:
why do I make things so hard...works like a charm!!!
thanks so much..
0
 
DFCRJAuthor Commented:
perfect
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now