CurrencyManager.RemoveAt(Int32) Metoda

Definicja

Usuwa element pod określonym indeksem.

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

Indeks elementu do usunięcia z listy.

Wyjątki

W określonym indexobiekcie nie ma wiersza .

Przykłady

Poniższy przykład kodu używa RemoveAt metody , aby usunąć element na pozycji 0 na liście.

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

Uwagi

Metoda została zaprojektowana RemoveAt w celu umożliwienia złożonych kontrolek, takich jak kontrolka DataGrid , usuwania elementów z listy. Nie należy używać tej metody do faktycznego usuwania elementów. Zamiast tego użyj Delete metody DataView klasy , aby usunąć elementy.

Dotyczy

Zobacz też