ComboBox.ObjectCollection.IList.Add(Object) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
For a description of this member, see Add(Object).
virtual int System.Collections.IList.Add(System::Object ^ item) = System::Collections::IList::Add;
int IList.Add(object item);
int IList.Add(object? item);
abstract member System.Collections.IList.Add : obj -> int
override this.System.Collections.IList.Add : obj -> int
Function Add (item As Object) As Integer Implements IList.Add
- item
- Object
An object that represents the item to add to the collection.
The zero-based index of the item in the collection.
The item
parameter is null
.
There is insufficient space available to store the new item.
This member is an explicit interface member implementation. It can be used only when the ComboBox.ObjectCollection instance is cast to an IList interface.
This method adds an item to the combo box. If the Sorted property of the ComboBox is set to true
, the item is inserted into the list alphabetically. Otherwise, the item is inserted at the end of the list.
A visual representation of the item is displayed in the combo box. This content representation is specified by the DisplayMember property. If the DisplayMember property is null
, the item's ToString method is called to obtain the string that is displayed in the combo box; otherwise, the property of the stored object as specified by the DisplayMember property is displayed. To add a set of items to the combo box, it is best to use the AddRange method. If you choose to use the Add method to add a set of items to the combo box, use the BeginUpdate method to suspend repainting during your add and the EndUpdate method to resume repainting. You can use the Insert method to specify the location in the list where an item is added. When an object is added to the collection, the ComboBox calls the object's ToString method to obtain the string to display in the list.
製品 | バージョン |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。