DataRepeater.CurrentItemIndex 속성

업데이트: 2007년 11월

DataRepeater 컨트롤의 현재 DataRepeaterItem을 가져오거나 설정합니다.

네임스페이스:  Microsoft.VisualBasic.PowerPacks
어셈블리:  Microsoft.VisualBasic.PowerPacks.Vs(Microsoft.VisualBasic.PowerPacks.Vs.dll)

구문

<BrowsableAttribute(False)> _
Public Property CurrentItemIndex As Integer

Dim instance As DataRepeater
Dim value As Integer

value = instance.CurrentItemIndex

instance.CurrentItemIndex = value
[BrowsableAttribute(false)]
public int CurrentItemIndex { get; set; }
[BrowsableAttribute(false)]
public:
property int CurrentItemIndex {
    int get ();
    void set (int value);
}
public function get CurrentItemIndex () : int
public function set CurrentItemIndex (value : int)

속성 값

형식: System.Int32

현재 DataRepeaterItem의 인덱스입니다.

설명

이 속성을 사용하여 DataRepeater 컨트롤의 CurrentItem에 대한 인덱스를 반환하거나 변경할 수 있습니다. CurrentItemIndex 속성을 설정하면 동일한 인덱스를 가진 DataRepeaterItem이 뷰로 스크롤됩니다.

참고:

DataRepeaterItem은 최소 스크롤 전략을 통해 뷰로 완전히 스크롤됩니다. 항목을 DataRepeater의 위쪽에 맞추려면 AlignWithTop 매개 변수에 true를 지정하여 ScrollItemIntoView 메서드를 호출합니다.

예제

다음 예제에서는 CurrentItemIndex 속성을 사용하여 검색 결과에 따라 DataRepeater 컨트롤의 항목에 포커스를 설정하는 방법을 보여 줍니다. 이 예제에서는 DataRepeater1이라는 DataRepeater 컨트롤, SearchTextBox라는 TextBox 및 SearchButton이라는 Button이 있고 DataRepeater가 Northwind 데이터베이스 Products 테이블의 데이터 소스에 바인딩되어 있다고 가정합니다.

Private Sub SearchButton_Click(ByVal sender As System.Object, ByVal e As  _
  System.EventArgs) Handles SearchButton.Click
    Dim foundIndex As Integer
    Dim searchString As String
    searchString = SearchTextBox.Text
    foundIndex = ProductsBindingSource.Find("ProductID", _
     searchString)
    If foundIndex > -1 Then
        DataRepeater1.CurrentItemIndex = foundIndex
    Else
        MsgBox("Item " & searchString & " not found.")
    End If
End Sub
private void searchButton_Click(System.Object sender, System.EventArgs e)
{
    int foundIndex;
    string searchString;
    searchString = searchTextBox.Text;
    foundIndex = productsBindingSource.Find("ProductID", searchString);
    if (foundIndex > -1)
    {
        dataRepeater1.CurrentItemIndex = foundIndex;
    }
    else
    {
        MessageBox.Show("Item " + searchString + " not found.");
    }
}

권한

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

DataRepeater 클래스

DataRepeater 멤버

Microsoft.VisualBasic.PowerPacks 네임스페이스

CurrentItemIndexChanged

기타 리소스

DataRepeater 컨트롤 소개(Visual Studio)