This documentation is archived and is not being maintained.

DataRepeater.ItemsAdded Event

Occurs when a new DataRepeaterItem is added to a DataRepeater control.

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

private event DataRepeaterAddRemoveItemsEventHandler ItemsAdded

The ItemsAdded event is raised when a request is made to add a new item, before the new item is displayed. Use this event to retrieve the index for the new item from the DataRepeaterAddRemoveItemsEventArgs.

In virtual mode, this event occurs before the ItemValuePushed event and can be used to create new records in your data store that you can then populate in the ItemValuePushed event handler.

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

The following example demonstrates how to retrieve the index for a new item in a DataRepeater control.

Private Sub DataRepeater1_ItemsAdded(ByVal sender As Object, _
 ByVal e As _
 Microsoft.VisualBasic.PowerPacks.DataRepeaterAddRemoveItemsEventArgs) _
 Handles DataRepeater1.ItemsAdded
    MsgBox("New item: " & CStr(e.ItemIndex))
End Sub