Compartilhar via


Evento DataRepeater.CurrentItemIndexChanged

Ocorre quando o CurrentItemIndex alterações.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (em Microsoft.VisualBasic.PowerPacks.Vs.dll)

Sintaxe

Public Event CurrentItemIndexChanged As EventHandler

Dim instance As DataRepeater
Dim handler As EventHandler

AddHandler instance.CurrentItemIndexChanged, handler
public event EventHandler CurrentItemIndexChanged
public:
 event EventHandler^ CurrentItemIndexChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
O JScript não oferece suporte a eventos.

Comentários

The CurrentItemIndex alterações quando o usuário seleciona um novo DataRepeaterItem ou quando o CurrentItemIndex é conjunto no código.

configuração the CurrentItemIndex propriedade rola o DataRepeaterItem que tem o índice equivalente para o modo de exibição.

Para obter mais informações sobre como lidar com eventos, consulte Consumindo Eventos.

Exemplos

O exemplo a seguir demonstra como usar o CurrentItem propriedade para fazer alterações quando um item é selecionado. Ele pressupõe que você tenha um formulário que contém um acoplado DataRepeater chamada DataRepeater1, um limite TextBox chamada UnitsInStockTextBoxe um Label chamada LowStockWarningLabel.

PrivateSub DataRepeater1_CurrentItemIndexChanged(ByVal sender _
 AsObject, ByVal e As System.EventArgs) Handles _
 DataRepeater1.CurrentItemIndexChanged
    ' Exit if the control is first loading.If DataRepeater1.CurrentItem IsNothingThenExitSub    ' 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 = TrueElseMe.LowStockWarningLabel.Visible = FalseEndIfEndSub
privatevoid 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;
    }
}

Permissões

Consulte também

Referência

DataRepeater Classe

Membros DataRepeater

Namespace Microsoft.VisualBasic.PowerPacks

CurrentItemIndex

Outros recursos

Introdução ao Controlarar de DataRepeater (Visual Studio)