Condividi tramite


Proprietà DataRepeater.CurrentItem

Ottiene l'oggetto corrente DataRepeaterItem in DataRepeater controllare.

Spazio dei nomi:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintassi

'Dichiarazione
<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

Valore proprietà

Tipo: Microsoft.VisualBasic.PowerPacks.DataRepeaterItem
l'oggetto attualmente selezionato.

Note

utilizzare CurrentItem proprietà per modificare i controlli o i dati su attualmente selezionato DataRepeaterItem in fase di esecuzione.

Esempi

Nell'esempio seguente viene illustrato come utilizzare CurrentItem proprietà per apportare modifiche quando viene selezionato un elemento.Si presuppone che si disponga di un form contenente un limite DataRepeater denominato DataRepeater1, un limite TextBox denominato UnitsInStockTextBoxe Label denominato 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;
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DataRepeater Classe

Spazio dei nomi Microsoft.VisualBasic.PowerPacks

CurrentItemIndexChanged

Altre risorse

Introduzione al controllo DataRepeater (Visual Studio)