How to get an array (or something with indexing) for of list box items

aewarnick

Senior Contributor
Joined
Jan 29, 2003
Messages
1,031
Ms says the listbox.SelectedItems returns a SelectedObjectCollection but this does not work:

SelectedObjectCollection x= this.listBox.SelectedItems;

What am I doing wrong? The compiler does not know what a SelectedObjectCollection is.
 
That works but it did not show up in the context menu as an auto complete. Even when I use System.Windows.Forms.ListBox it does not show up.

Also, I cannot use x.Length to reference each object in the collection and there is no context menu at all when I press x then a dot. Do I need a reference or something?
 
Back
Top