Can't convert ListBox.ObjectCollection to a (typed) array

Posted by D. Veloper on Stack Overflow See other posts from Stack Overflow or by D. Veloper
Published on 2010-04-08T10:36:02Z Indexed on 2010/04/08 10:53 UTC
Read the original article Hit count: 106

Filed under:
|
|
|
|

I want to convert the items to a String array or the type that I used to fill the ListBox.DataSource. The type has overridden ToString() but I can't seems to get it converted, not even to String[].

String[] a = (String[])ListBox1.Items;
Contacts[] b = (Contacts[])ListBox1.Items;

© Stack Overflow or respective owner

Related posts about c#

Related posts about listbox