ListBox.ObjectCollection.Insert(Int32, Object) Method
Definition
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.
Inserts an item into the list box at the specified index.
public:
virtual void Insert(int index, System::Object ^ item);
public:
void Insert(int index, System::Object ^ item);
public void Insert (int index, object item);
abstract member Insert : int * obj -> unit
override this.Insert : int * obj -> unit
member this.Insert : int * obj -> unit
Public Sub Insert (index As Integer, item As Object)
Parameters
- index
- Int32
The zero-based index location where the item is inserted.
- item
- Object
An object representing the item to insert.
Implements
Exceptions
The index
parameter is less than zero or greater than value of the Count property of the ListBox.ObjectCollection class.
item
is null
.
Remarks
This method enables you to insert an item at a specific position within the ListBox. If the Sorted property of the ListBox is set to true, the item is added in the correct position within the sorted list regardless of the values specified in the index
parameter. When an object is added to the collection, the ListBox first checks to see if the DisplayMember property of the ListControl class has the name of a member from the object specified to reference when obtaining the item text. If the DisplayMember property does not have a member specified, the ListBox then calls the ToString method of the object to obtain the text to display in the list.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기