DataRepeater.RemoveAt Method (Int32)

 

Removes a DataRepeaterItem at the specified position from a DataRepeater control.

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

public void RemoveAt(
	int index
)

Parameters

index
Type: System.Int32

The index of the DataRepeaterItem.

Exception Condition
ArgumentOutOfRangeException

The value specified for index is less than 0 or greater than ItemCount - 1.

Calling the RemoveAt method removes the specified DataRepeaterItem from the DataRepeater at run time. It does not remove the record from the underlying DataSet.

The following example demonstrates how to use the RemoveAt method to remove the second item in a DataRepeater. It assumes that you have a form that contains a DataRepeater control named DataRepeater1 and a Button control named RemoveButton.

private void removeButton_Click(object sender, System.EventArgs e)
{
    // Remove the second item. (Index is zero-based.)
    dataRepeater1.RemoveAt(1);
}
Return to top
Show: