DataRepeater.CurrentItemIndexChanged Event

Occurs when the CurrentItemIndex changes.

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


Public Event CurrentItemIndexChanged As EventHandler
Dim instance As DataRepeater 
Dim handler As EventHandler 

AddHandler instance.CurrentItemIndexChanged, handler
public event EventHandler CurrentItemIndexChanged
 event EventHandler^ CurrentItemIndexChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
JScript does not support events.


The CurrentItemIndex changes when the user selects a new DataRepeaterItem or when the CurrentItemIndex is set in code.

Setting the CurrentItemIndex property scrolls the DataRepeaterItem that has the equivalent index into view.

For more information about how to handle events, see Consuming Events.


The following example demonstrates how to use the CurrentItem property to make changes when an item is selected. It assumes that you have a form that contains a bound DataRepeater named DataRepeater1, a bound TextBox named UnitsInStockTextBox, and a Label named LowStockWarningLabel.

Private Sub DataRepeater1_CurrentItemIndexChanged(ByVal sender _
 As Object, ByVal e As System.EventArgs) Handles _
    ' 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 
        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;
        this.lowStockWarningLabel.Visible = false;

.NET Framework Security

See Also


DataRepeater Class

DataRepeater Members

Microsoft.VisualBasic.PowerPacks Namespace


Other Resources

Introduction to the DataRepeater Control (Visual Studio)