ListBox.SelectedObjectCollection Class
TOC
Collapse the table of content
Expand the table of content

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)

System.Object
  System.Windows.Forms.ListBox.SelectedObjectCollection

Public Class SelectedObjectCollection
	Implements IList, ICollection, IEnumerable

NameDescription
System_CAPS_pubmethodListBox.SelectedObjectCollection(ListBox)

Initializes a new instance of the ListBox.SelectedObjectCollection class.

NameDescription
System_CAPS_pubpropertyCount

Gets the number of items in the collection.

System_CAPS_pubpropertyIsReadOnly

Gets a value indicating whether the collection is read-only.

System_CAPS_pubpropertyItem(Int32)

Gets the item at the specified index within the collection.

NameDescription
System_CAPS_pubmethodAdd(Object)

Adds an item to the list of selected items for a ListBox.

System_CAPS_pubmethodClear()

Removes all items from the collection of selected items.

System_CAPS_pubmethodContains(Object)

Determines whether the specified item is located within the collection.

System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the entire collection into an existing array at a specified location within the array.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Returns an enumerator that can be used to iterate through the selected item collection.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodIndexOf(Object)

Returns the index within the collection of the specified item.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodRemove(Object)

Removes the specified object from the collection of selected items.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Add(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IList.Add.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Clear()

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IList.Clear.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Insert(Int32, Object)

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IList.Insert.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.Remove(Object)

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IList.Remove.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIList.RemoveAt(Int32)

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IList.RemoveAt.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.IsSynchronized

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see ICollection.IsSynchronized.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyICollection.SyncRoot

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see ICollection.SyncRoot.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyIList.IsFixedSize

This API supports the product infrastructure and is not intended to be used directly from your code. For a description of this member, see IList.IsFixedSize.

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast(Of TResult)()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType(Of TResult)()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

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.

.NET Framework
Available since 1.1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft