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)
Syntax
public void RemoveAt(
int index
)
public:
void RemoveAt(
int index
)
member RemoveAt :
index:int -> unit
Public Sub RemoveAt (
index As Integer
)
Parameters
index
Type: System.Int32The index of the DataRepeaterItem.
Exceptions
Exception | Condition |
---|---|
ArgumentOutOfRangeException | The value specified for index is less than 0 or greater than ItemCount - 1. |
Remarks
Calling the RemoveAt method removes the specified DataRepeaterItem from the DataRepeater at run time. It does not remove the record from the underlying DataSet.
Examples
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);
}
Private Sub RemoveButton_Click() Handles RemoveButton.Click
' Remove the second item. (Index is zero-based.)
DataRepeater1.RemoveAt(1)
End Sub
See Also
DataRepeater Class
Microsoft.VisualBasic.PowerPacks Namespace
Introduction to the DataRepeater Control (Visual Studio)
How to: Disable Adding and Deleting DataRepeater Items (Visual Studio)
Return to top