다음을 통해 공유


DataRepeater.CurrentItem 속성

현재를 가져옵니다 DataRepeaterItemDataRepeater 컨트롤입니다.

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

구문

‘선언
<BrowsableAttribute(False)> _
Public ReadOnly Property CurrentItem As DataRepeaterItem
[BrowsableAttribute(false)]
public DataRepeaterItem CurrentItem { get; }
[BrowsableAttribute(false)]
public:
property DataRepeaterItem^ CurrentItem {
    DataRepeaterItem^ get ();
}
[<BrowsableAttribute(false)>]
member CurrentItem : DataRepeaterItem
function get CurrentItem () : DataRepeaterItem

속성 값

형식: Microsoft.VisualBasic.PowerPacks.DataRepeaterItem
현재 선택한 개체입니다.

설명

사용은 CurrentItem 컨트롤 또는 현재 선택한 항목의 데이터를 변경 하려면 속성 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 네임스페이스

CurrentItemIndexChanged

기타 리소스

DataRepeater 컨트롤 소개(Visual Studio)