DataRepeater.CurrentItem (Propiedad)

obtiene DataRepeaterItem actual en un control de DataRepeater .

Espacio de nombres:  Microsoft.VisualBasic.PowerPacks
Ensamblado:  Microsoft.VisualBasic.PowerPacks.Vs (en Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintaxis

'Declaración
<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

Valor de propiedad

Tipo: Microsoft.VisualBasic.PowerPacks.DataRepeaterItem
El objeto seleccionado actualmente.

Comentarios

Utilice la propiedad de CurrentItem para cambiar los controles o los datos en DataRepeaterItem seleccionado actualmente en tiempo de ejecución.

Ejemplos

El ejemplo siguiente se muestra cómo utilizar la propiedad de CurrentItem para realizar cambios cuando un elemento está seleccionado.Se supone que tiene un formulario que contiene DataRepeater enlazado denominado DataRepeater1, TextBox enlazado denominado UnitsInStockTextBox, y Label denominado 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;
    }
}

Seguridad de .NET Framework

Vea también

Referencia

DataRepeater Clase

Microsoft.VisualBasic.PowerPacks (Espacio de nombres)

CurrentItemIndexChanged

Otros recursos

Introducción al control DataRepeater (Visual Studio)