Freigeben über


CurrencyManager.RemoveAt-Methode

Entfernt das Element am angegebenen Index.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Overrides Sub RemoveAt ( _
    index As Integer _
)
'Usage
Dim instance As CurrencyManager
Dim index As Integer

instance.RemoveAt(index)
public override void RemoveAt (
    int index
)
public:
virtual void RemoveAt (
    int index
) override
public void RemoveAt (
    int index
)
public override function RemoveAt (
    index : int
)

Parameter

  • index
    Der Index des aus der Liste zu entfernenden Elements.

Ausnahmen

Ausnahmetyp Bedingung

IndexOutOfRangeException

Am angegebenen index ist keine Zeile vorhanden.

Hinweise

Die RemoveAt-Methode wurde entworfen, damit komplexe Steuerelemente, z. B. das DataGrid-Steuerelement, Elemente aus der Liste entfernen können. Mit dieser Methode dürfen keine Elemente tatsächlich entfernt werden. Entfernen Sie Elemente stattdessen mit der Delete-Methode der DataView-Klasse.

Beispiel

Im folgenden Codebeispiel wird mithilfe der RemoveAt-Methode das Element an Position 0 (null) in der Liste entfernt.

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 'RemoveFromList
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);
}
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.get_BindingContext().
        get_Item((System.Int32)0));
    // If the count is 0, exit the function.
    if (myCurrencyManager.get_Count() > 1) {
        myCurrencyManager.RemoveAt(0);
    }
} //RemoveFromList
private function RemoveFromList(){
    // Get the CurrencyManager of a TextBox control.
    var myCurrencyManager : CurrencyManager  = CurrencyManager(textBox1.BindingContext[0]);
    // If the count is 0, exit the function.
    if(myCurrencyManager.Count > 1)
    myCurrencyManager.RemoveAt(0);
}

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

CurrencyManager-Klasse
CurrencyManager-Member
System.Windows.Forms-Namespace
AddNew
Count