Freigeben über


DataRepeater.RemoveAt Method

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

'Declaration
Public Sub RemoveAt ( _
    index As Integer _
)
public void RemoveAt(
    int index
)
public:
void RemoveAt(
    int index
)
member RemoveAt : 
        index:int -> unit 
public function RemoveAt(
    index : int
)

Parameters

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 Sub RemoveButton_Click() Handles RemoveButton.Click
    ' Remove the second item. (Index is zero-based.)
    DataRepeater1.RemoveAt(1)
End Sub
private void removeButton_Click(object sender, System.EventArgs e)
{
    // Remove the second item. (Index is zero-based.)
    dataRepeater1.RemoveAt(1);
}

.NET Framework Security

See Also

Reference

DataRepeater Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

Introduction to the DataRepeater Control (Visual Studio)

How to: Disable Adding and Deleting DataRepeater Items (Visual Studio)