Compartir a través de


DataRepeater.CurrentItem (Propiedad)

Obtiene el DataRepeaterItem actual en un control 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 with get
function get CurrentItem () : DataRepeaterItem

Valor de propiedad

Tipo: Microsoft.VisualBasic.PowerPacks.DataRepeaterItem
Objeto seleccionado en estos momentos.

Comentarios

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

Ejemplos

En el ejemplo siguiente se muestra cómo utilizar el CurrentItem propiedad realizar cambios cuando se selecciona un elemento. Se supone que tiene un formulario que contiene un límite DataRepeater denominado DataRepeater1, un límite TextBox denominado UnitsInStockTextBoxy un 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)