다음을 통해 공유


ListBox.SelectedIndexCollection.IndexOf 메서드

ListBoxListBox.ObjectCollection에서 지정된 인덱스의 ListBox.SelectedIndexCollection 내 인덱스를 반환합니다.

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

구문

‘선언
Public Function IndexOf ( _
    selectedIndex As Integer _
) As Integer
‘사용 방법
Dim instance As SelectedIndexCollection
Dim selectedIndex As Integer
Dim returnValue As Integer

returnValue = instance.IndexOf(selectedIndex)
public int IndexOf (
    int selectedIndex
)
public:
int IndexOf (
    int selectedIndex
)
public int IndexOf (
    int selectedIndex
)
public function IndexOf (
    selectedIndex : int
) : int

매개 변수

반환 값

컬렉션에서 ListBox.ObjectCollection의 지정된 인덱스가 ListBox.SelectedIndexCollection에 위치해 있으면 0부터 시작하는 인덱스가 반환되고, 그렇지 않으면 -1이 반환됩니다.

설명

Contains 메서드를 사용하여 항목이 컬렉션에 있다는 사실을 확인한 경우 IndexOf 메서드를 사용하여 ListBox에 대한 ListBox.ObjectCollection 내 특정 인덱스 항목이 ListBox.SelectedIndexCollection의 어느 위치에 저장되어 있는지 알 수 있습니다.

플랫폼

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

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

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

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