CurrencyManager.RemoveAt(Int32) Metoda

Definice

Odebere položku v zadaném indexu.

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, kterou chcete 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 komplexní ovládací prvky, jako DataGrid je například ovládací prvek, odebrat položky ze seznamu. Tuto metodu byste neměli používat k skutečnému odebrání položek. Místo toho použijte Delete metodu DataView třídy k odstranění položek.

Platí pro

Viz také