다음을 통해 공유


ListBox.ObjectCollection.Insert 메서드

지정된 인덱스에 있는 목록 상자에 항목을 삽입합니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Sub Insert ( _
    index As Integer, _
    item As Object _
)
‘사용 방법
Dim instance As ObjectCollection
Dim index As Integer
Dim item As Object

instance.Insert(index, item)
public void Insert (
    int index,
    Object item
)
public:
virtual void Insert (
    int index, 
    Object^ item
) sealed
public final void Insert (
    int index, 
    Object item
)
public final function Insert (
    index : int, 
    item : Object
)

매개 변수

  • index
    항목이 삽입되는 0부터 시작하는 인덱스 위치입니다.
  • item
    삽입할 항목을 나타내는 개체입니다.

예외

예외 형식 조건

ArgumentOutOfRangeException

index 매개 변수가 0보다 작거나 ListBox.ObjectCollection 클래스의 Count 속성 값보다 크거나 같은 경우

설명

이 메서드를 사용하면 ListBox의 특정 위치에 항목을 삽입할 수 있습니다. ListBoxSorted 속성이 true로 설정되어 있으면, 항목은 index 매개 변수에 지정된 값과 상관 없이 정렬된 목록의 올바른 위치에 추가됩니다. 컬렉션에 개체를 추가할 경우, ListBox는 우선 ListControl 클래스의 DisplayMember 속성이 항목 텍스트를 가져올 때 참조에 지정된 개체에 구성원의 이름이 포함되는지 여부를 확인합니다. DisplayMember 속성이 구성원을 지정하지 않을 경우, ListBox는 개체의 ToString 메서드를 호출하여 텍스트를 목록에 표시합니다.

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

ListBox.ObjectCollection 클래스
ListBox.ObjectCollection 멤버
System.Windows.Forms 네임스페이스