Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ListBox.SelectedObjectCollection Class

Represents the collection of selected items in the ListBox.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public class SelectedObjectCollection : IList, ICollection, IEnumerable
public class SelectedObjectCollection implements IList, ICollection, 
	IEnumerable
public class SelectedObjectCollection implements IList, ICollection, 
	IEnumerable
Not applicable.

The ListBox.SelectedObjectCollection class stores the selected items in the ListBox. The items stored in the ListBox.SelectedObjectCollection are items contained within the ListBox.ObjectCollection class. The ListBox.ObjectCollection class stores all items displayed in the ListBox.

The following table is an example of how the ListBox.ObjectCollection stores the items of the ListBox as well as their selection states within an example ListBox.

Index

Item

Selection state within the ListBox

0

object1

Unselected

1

object2

Selected

2

object3

Unselected

3

object4

Selected

4

object5

Selected

Based on the ListBox.ObjectCollection demonstrated in the previous table, the following table demonstrates how the ListBox.SelectedObjectCollection would appear.

Index

Selected item from ObjectCollection

0

object2

1

object4

2

object5

You can use the properties and methods of this class to perform a variety of tasks with the collection. The Contains method enables you to determine whether an item from the ListBox.ObjectCollection class is a member of the ListBox.SelectedObjectCollection. Once you know that the item is located within the collection, you can use the IndexOf method to determine where a specific item within the ListBox.ObjectCollection for the ListBox is stored within the ListBox.SelectedObjectCollection.

System.Object
  System.Windows.Forms.ListBox.SelectedObjectCollection
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

Show:
© 2014 Microsoft. All rights reserved.