Anand,
The listbox exposes the Items property, which returns a type of
ListBox.ObjectCollection. This type implements IEnumerable, which means you
can use in a for each statement.
The ListBox.ObjectCollection class holds instances of type object
though. The ListBox accesses the property indicated in the DisplayMember
property of the ListBox, or calls ToString on the object, if the
DisplayMember property does not have a value.
Also, if the list box is data-bound, then the Items property will have
no items in it, and you will have to access the listbox's data source
directly.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Anand Ganesh" <ag*****@nobel-systems.comwrote in message
news:OQ**************@TK2MSFTNGP02.phx.gbl...
Hello All,
I want to go through each item in a Listbox collection. How will I do
this?
I was looking for ListBoxItem but nothing is available?
Any suggestions please?
Thanks
Anand Ganesh