System.Windows.Forms


.NET Framework Class Library
ComboBox.ObjectCollection Class

This class supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Represents the collection of items in a ComboBox.

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

Syntax

Visual Basic (Declaration)
Public Class ObjectCollection
    Implements IList, ICollection, IEnumerable
Visual Basic (Usage)
Dim instance As ObjectCollection
C#
public class ObjectCollection : IList, ICollection, IEnumerable
C++
public ref class ObjectCollection : IList, ICollection, IEnumerable
J#
public class ObjectCollection implements IList, ICollection, 
    IEnumerable
JScript
public class ObjectCollection implements IList, ICollection, 
    IEnumerable
Remarks

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.

Inheritance Hierarchy

System.Object
  System.Windows.Forms.ComboBox.ObjectCollection
Thread Safety

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

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Version Information

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
See Also

Tags :


Page view tracker