ComboBox.ObjectCollection Class
TOC
Collapse the table of content
Expand the table of content

ComboBox.ObjectCollection Class

 

Represents the collection of items in a ComboBox.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

System.Object
  System.Windows.Forms.ComboBox.ObjectCollection

[ListBindableAttribute(false)]
public class ObjectCollection : IList, ICollection, IEnumerable

NameDescription
System_CAPS_pubmethodComboBox.ObjectCollection(ComboBox)

Initializes a new instance of System.Windows.Forms.ComboBox.ObjectCollection.

NameDescription
System_CAPS_pubpropertyCount

Gets the number of items in the collection.

System_CAPS_pubpropertyIsReadOnly

Gets a value indicating whether this collection can be modified.

System_CAPS_pubpropertyItem[Int32]

Retrieves the item at the specified index within the collection.

NameDescription
System_CAPS_pubmethodAdd(Object)

Adds an item to the list of items for a ComboBox.

System_CAPS_pubmethodAddRange(Object[])

Adds an array of items to the list of items for a ComboBox.

System_CAPS_pubmethodClear()

Removes all items from the ComboBox.

System_CAPS_pubmethodContains(Object)

Determines if the specified item is located within the collection.

System_CAPS_pubmethodCopyTo(Object[], Int32)

Copies the entire collection into an existing array of objects 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 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)

Retrieves the index within the collection of the specified item.

System_CAPS_pubmethodInsert(Int32, Object)

Inserts an item into the collection at the specified index.

System_CAPS_protmethodMemberwiseClone()

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

System_CAPS_pubmethodRemove(Object)

Removes the specified item from the ComboBox.

System_CAPS_pubmethodRemoveAt(Int32)

Removes an item from the ComboBox at the specified index.

System_CAPS_pubmethodToString()

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

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodICollection.CopyTo(Array, 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 ICollection.CopyTo.

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_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<TResult>()

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

System_CAPS_pubmethodOfType<TResult>()

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

The System.Windows.Forms.ComboBox.ObjectCollection class encapsulates the items in the ComboBox. The object collection of a combo box can be used to manage many types of objects, including strings, images, and custom business objects.

You can add items to the collection in several ways. The Add method adds one object to the collection. To add a number of objects to the collection, it is best to create an array of items and assign with the AddRange method. To insert an object at a specific location within the collection, you can use the Insert method. To remove items at a known index in the collection you can use either the Remove method or the RemoveAt method. The Clear method removes all the items from the collection.

In addition to methods and properties for adding and removing items, the System.Windows.Forms.ComboBox.ObjectCollection also provides methods to find items within the collection. The Contains method enables you to determine if an object is a member of the collection. Once you know that the item is located within the collection, you can use the IndexOf method to determine where the item is located within the collection.

.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