943,715 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 1211
  • C# RSS
Sep 26th, 2008
0

How do I check how MANY items a listbox has?

Expand Post »
For instance in a "For" loop:

C# Syntax (Toggle Plain Text)
  1. for(int i = 0;i<=listBox1.

What could I place after the "." at the end to check so it doesn't keep on working after the number of items?
Similar Threads
Reputation Points: 19
Solved Threads: 1
Light Poster
papuccino1 is offline Offline
45 posts
since Aug 2008
Sep 27th, 2008
1

Re: How do I check how MANY items a listbox has?

try something like this:

for (int i = 0; i < listBox1.Items.Count; i++)

make sure it's i < and not i <= since you are starting with index 0.

Good luck
Reputation Points: 11
Solved Threads: 9
Junior Poster in Training
vckicks is offline Offline
58 posts
since Jun 2008
Sep 27th, 2008
0

Re: How do I check how MANY items a listbox has?

Cool, thank you for your tip. I'll try it out later tonight.
Reputation Points: 19
Solved Threads: 1
Light Poster
papuccino1 is offline Offline
45 posts
since Aug 2008
Sep 29th, 2008
0

Re: How do I check how MANY items a listbox has?

Read the intellisense of the property, it will help you. I think you did not do some efforts... hehehehe no offense meant, that's for your own good. if problem persist consult your f***n brilliant mind, I know you have lots of guts!!!

regards.
Reputation Points: 11
Solved Threads: 49
Posting Whiz
jireh is offline Offline
316 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Query Builder
Next Thread in C# Forum Timeline: arraylist





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC