ListView.FindItemWithText 메서드

정의

주어진 텍스트 값으로 시작하는 첫 번째 ListViewItem을 찾습니다.

오버로드

FindItemWithText(String)

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem을 찾습니다.

FindItemWithText(String, Boolean, Int32)

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem이나 ListViewItem.ListViewSubItem(지정된 경우)을 찾습니다. 검색은 지정된 인덱스에서 시작합니다.

FindItemWithText(String, Boolean, Int32, Boolean)

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem이나 ListViewItem.ListViewSubItem(지정된 경우)을 찾습니다. 검색은 지정된 인덱스에서 시작합니다.

FindItemWithText(String)

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem을 찾습니다.

public:
 System::Windows::Forms::ListViewItem ^ FindItemWithText(System::String ^ text);
public System.Windows.Forms.ListViewItem FindItemWithText (string text);
public System.Windows.Forms.ListViewItem? FindItemWithText (string text);
member this.FindItemWithText : string -> System.Windows.Forms.ListViewItem
Public Function FindItemWithText (text As String) As ListViewItem

매개 변수

text
String

검색할 텍스트입니다.

반환

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem입니다.

예제

다음 코드 예제는 FindItemWithText 메서드. 이 예제를 실행하려면 다음 코드를 Windows Form에 붙여넣고 폼의 생성자 또는 Load 이벤트 처리기에서 메서드를 호출 InitializeFindListView 합니다. 단추를 클릭하여 메서드 호출의 결과를 확인합니다.

// Declare the ListView and Button for the example.
ListView findListView = new ListView();
Button findButton = new Button();

private void InitializeFindListView()
{
// Set up the location and event handling for the button.
    findButton.Click += new EventHandler(findButton_Click);
    findButton.Location = new Point(10, 10);
    
// Set up the location of the ListView and add some items.
findListView.Location = new Point(10, 30);
    findListView.Items.Add(new ListViewItem("angle bracket"));
    findListView.Items.Add(new ListViewItem("bracket holder"));
    findListView.Items.Add(new ListViewItem("bracket"));

    // Add the button and ListView to the form.
    this.Controls.Add(findButton);
    this.Controls.Add(findListView);
}

void findButton_Click(object sender, EventArgs e)
{
        // Call FindItemWithText, sending output to MessageBox.
    ListViewItem item1 = findListView.FindItemWithText("brack");
     if (item1 != null)
         MessageBox.Show("Calling FindItemWithText passing 'brack': " 
             + item1.ToString());
     else
         MessageBox.Show("Calling FindItemWithText passing 'brack': null");
 }
' Declare the ListView and Button for the example.
Private findListView As New ListView()
Private WithEvents findButton As New Button()


Private Sub InitializeFindListView()

    ' Set up the location and event handling for the button.
    findButton.Location = New Point(10, 10)

    ' Set up the location of the ListView and add some items.
    findListView.Location = New Point(10, 30)
    findListView.Items.Add(New ListViewItem("angle bracket"))
    findListView.Items.Add(New ListViewItem("bracket holder"))
    findListView.Items.Add(New ListViewItem("bracket"))

    ' Add the button and ListView to the form.
    Me.Controls.Add(findButton)
    Me.Controls.Add(findListView)

End Sub

Private Sub findButton_Click(ByVal sender As Object, ByVal e As EventArgs) _
    Handles findButton.Click

    ' Call FindItemWithText, sending output to MessageBox.
    Dim item1 As ListViewItem = findListView.FindItemWithText("brack")
    If (item1 IsNot Nothing) Then
        MessageBox.Show("Calling FindItemWithText passing 'brack': " _
            & item1.ToString())
    Else
        MessageBox.Show("Calling FindItemWithText passing 'brack': null")
    End If

End Sub

설명

검색은 대/소문자를 구분합니다.

매개 변수는 text 원하는 일치 텍스트의 부분 문자열을 지정할 수 있습니다. 또한 이 메서드는 지정된 텍스트로 시작하는 첫 번째 항목을 반환합니다. 예를 들어 에 ListView 두 개의 목록 항목(첫 번째 항목의 텍스트가 "꺾쇠 괄호"로 설정되고 두 번째 항목의 텍스트가 "대괄호"로 설정된 경우) 매개 변수로 전달 brackFindItemWithText 호출하면 텍스트가 "대괄호"인 항목이 반환됩니다.

FindItemWithText 목록이 비어 있거나 일치하는 항목이 없으면 메서드가 를 반환 null 합니다.

적용 대상

FindItemWithText(String, Boolean, Int32)

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem이나 ListViewItem.ListViewSubItem(지정된 경우)을 찾습니다. 검색은 지정된 인덱스에서 시작합니다.

public:
 System::Windows::Forms::ListViewItem ^ FindItemWithText(System::String ^ text, bool includeSubItemsInSearch, int startIndex);
public System.Windows.Forms.ListViewItem FindItemWithText (string text, bool includeSubItemsInSearch, int startIndex);
public System.Windows.Forms.ListViewItem? FindItemWithText (string text, bool includeSubItemsInSearch, int startIndex);
member this.FindItemWithText : string * bool * int -> System.Windows.Forms.ListViewItem
Public Function FindItemWithText (text As String, includeSubItemsInSearch As Boolean, startIndex As Integer) As ListViewItem

매개 변수

text
String

검색할 텍스트입니다.

includeSubItemsInSearch
Boolean

검색에 하위 항목을 포함시키려면 true이고, 그렇지 않으면 false입니다.

startIndex
Int32

검색을 시작할 항목의 인덱스입니다.

반환

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem입니다.

예외

startIndex가 0보다 작고 ListView의 항목 수보다 큰 경우

설명

검색은 대/소문자를 구분합니다.

매개 변수는 text 원하는 일치 텍스트의 부분 문자열을 지정할 수 있습니다. 또한 이 메서드는 지정된 텍스트로 시작하는 첫 번째 항목을 반환합니다. 예를 들어 에 ListView 두 개의 목록 항목(첫 번째 항목의 텍스트가 "꺾쇠 괄호"로 설정되고 두 번째 항목의 텍스트가 "대괄호"로 설정된 경우) 매개 변수로 "brack"을 FindItemWithText 전달하는 호출은 텍스트가 "대괄호"인 항목을 반환합니다.

FindItemWithText 목록이 비어 있거나 일치하는 항목이 없으면 메서드가 를 반환 null 합니다.

적용 대상

FindItemWithText(String, Boolean, Int32, Boolean)

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem이나 ListViewItem.ListViewSubItem(지정된 경우)을 찾습니다. 검색은 지정된 인덱스에서 시작합니다.

public:
 System::Windows::Forms::ListViewItem ^ FindItemWithText(System::String ^ text, bool includeSubItemsInSearch, int startIndex, bool isPrefixSearch);
public System.Windows.Forms.ListViewItem FindItemWithText (string text, bool includeSubItemsInSearch, int startIndex, bool isPrefixSearch);
public System.Windows.Forms.ListViewItem? FindItemWithText (string text, bool includeSubItemsInSearch, int startIndex, bool isPrefixSearch);
member this.FindItemWithText : string * bool * int * bool -> System.Windows.Forms.ListViewItem
Public Function FindItemWithText (text As String, includeSubItemsInSearch As Boolean, startIndex As Integer, isPrefixSearch As Boolean) As ListViewItem

매개 변수

text
String

검색할 텍스트입니다.

includeSubItemsInSearch
Boolean

검색에 하위 항목을 포함시키려면 true이고, 그렇지 않으면 false입니다.

startIndex
Int32

검색을 시작할 항목의 인덱스입니다.

isPrefixSearch
Boolean

부분 일치를 허용하려면 true이고, 그렇지 않으면 false입니다.

반환

지정된 텍스트 값으로 시작하는 첫 번째 ListViewItem입니다.

예외

startIndex가 0보다 작고 ListView의 항목 수보다 큰 경우

설명

FindItemWithText 목록이 비어 있거나 일치하는 항목이 없으면 메서드가 를 반환 null 합니다.

검색은 대/소문자를 구분합니다.

매개 변수는 text 원하는 일치 텍스트의 부분 문자열을 지정할 수 있습니다. 이 메서드는 에 대해 전달isPrefixSearch되지 않는 한 false 지정된 텍스트로 시작하는 첫 번째 항목을 반환합니다. 예를 들어 에 ListView 두 개의 목록 항목(첫 번째 항목의 텍스트가 "꺾쇠 괄호"로 설정되고 두 번째 항목의 텍스트가 "대괄호"로 설정된 경우) 검색 텍스트로 "brack"을 FindItemWithText 전달하는 호출은 텍스트가 "대괄호"인 항목을 반환합니다. 이 로 설정된 경우 isPrefixSearch 이 호출은 를 반환null합니다.false

적용 대상