Share via


CurrencyManager.RemoveAt(Int32) Metoda

Definice

Odebere položku z pozice se zadaným indexem.

public:
 override void RemoveAt(int index);
public override void RemoveAt (int index);
override this.RemoveAt : int -> unit
Public Overrides Sub RemoveAt (index As Integer)

Parametry

index
Int32

Index položky, která se má ze seznamu odebrat.

Výjimky

V zadaném indexřádku není žádný řádek .

Příklady

Následující příklad kódu používá metodu RemoveAt k odebrání položky na pozici 0 v seznamu.

void RemoveFromList()
{
   
   // Get the CurrencyManager of a TextBox control.
   CurrencyManager^ myCurrencyManager = dynamic_cast<CurrencyManager^>(textBox1->BindingContext[nullptr]);
   
   // If the count is 0, exit the function.
   if ( myCurrencyManager->Count > 1 )
         myCurrencyManager->RemoveAt( 0 );
}
private void RemoveFromList(){
    // Get the CurrencyManager of a TextBox control.
    CurrencyManager myCurrencyManager = (CurrencyManager)textBox1.BindingContext[0];
    // If the count is 0, exit the function.
    if(myCurrencyManager.Count > 1)
    myCurrencyManager.RemoveAt(0);
}
Private Sub RemoveFromList()
    ' Get the CurrencyManager of a TextBox control.
    Dim myCurrencyManager As CurrencyManager = CType(textBox1.BindingContext(0), CurrencyManager)
    ' If the count is 0, exit the function.
    If myCurrencyManager.Count > 1 Then
        myCurrencyManager.RemoveAt(0)
    End If
    
End Sub

Poznámky

Metoda RemoveAt byla navržena tak, aby umožňovala odebrání položek ze seznamu složitým ovládacím prvkům, jako DataGrid je například ovládací prvek. Tuto metodu byste neměli používat k skutečnému odebrání položek. Místo toho použijte metodu DeleteDataView třídy k odstranění položek.

Platí pro

Viz také