Represents the collection of items in a ComboBox.
For a list of all members of this type, see ComboBox.ObjectCollection Members.
[Visual Basic] Public Class ComboBox.ObjectCollection Implements IList, ICollection, IEnumerable [C#] public class ComboBox.ObjectCollection : IList, ICollection, IEnumerable [C++] public __gc class ComboBox.ObjectCollection : public IList, ICollection, IEnumerable [JScript] public class ComboBox.ObjectCollection implements IList, ICollection, IEnumerable
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
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.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)