다음을 통해 공유


DataRepeater.CurrentItemIndexChanged 이벤트

CurrentItemIndex이 변경될 때 발생합니다.

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

구문

‘선언
Public Event CurrentItemIndexChanged As EventHandler
public event EventHandler CurrentItemIndexChanged
public:
 event EventHandler^ CurrentItemIndexChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
member CurrentItemIndexChanged : IEvent<EventHandler,
    EventArgs>
JScript에서는 이벤트를 지원하지 않습니다.

설명

CurrentItemIndex 새로 선택할 때 변경 DataRepeaterItem 때 나는 CurrentItemIndex 코드에서 설정 됩니다.

설정 하는 CurrentItemIndex 속성으로 스크롤합니다는 DataRepeaterItem 가 보기에 해당 하는 인덱스입니다.

이벤트를 처리하는 방법에 대한 자세한 내용은 이벤트 사용을 참조하십시오.

예제

다음 예제에서는 CurrentItem 속성은 항목을 선택할 때 변경할 수 있습니다.포함 하는 폼 있다고 가정 DataRepeater 라는 DataRepeater1은 TextBox 라는 UnitsInStockTextBox, a Label 라는 LowStockWarningLabel.

Private Sub DataRepeater1_CurrentItemIndexChanged(
  ) Handles DataRepeater1.CurrentItemIndexChanged

    ' Exit if the control is first loading.
    If DataRepeater1.CurrentItem Is Nothing Then Exit Sub
    ' Check for zero or negative quantity.
    If CDbl(
        DataRepeater1.CurrentItem.Controls("UnitsInStockTextBox").Text
       ) < 1 Then
        ' Display a the warning label on the form.
        Me.LowStockWarningLabel.Visible = True
    Else
        Me.LowStockWarningLabel.Visible = False
    End If
End Sub
private void dataRepeater1_CurrentItemIndexChanged(object sender, System.EventArgs e)
{
    // Exit if the control is first loading.
    if (dataRepeater1.CurrentItem == null) { return; }
    // Check for zero quantity.
    if (dataRepeater1.CurrentItem.Controls["unitsInStockTextBox"].Text == "0") 
    // Display a the warning label on the form.
    {
        this.lowStockWarningLabel.Visible = true;
    }
    else
    {
        this.lowStockWarningLabel.Visible = false;
    }
}

.NET Framework 보안

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

참고 항목

참조

DataRepeater 클래스

Microsoft.VisualBasic.PowerPacks 네임스페이스

CurrentItemIndex

기타 리소스

DataRepeater 컨트롤 소개(Visual Studio)