CurrencyManager.RemoveAt(Int32) メソッド

定義

指定したインデックス位置にある項目を削除します。

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

パラメーター

index
Int32

リストから削除する項目のインデックス。

例外

指定された index の位置に行がありません。

次のコード例では、 メソッドを 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.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

注釈

メソッドは RemoveAt 、コントロールなどの複雑なコントロールが DataGrid リストから項目を削除できるように設計されました。 アイテムを実際に削除するには、このメソッドを使用しないでください。 代わりに、 クラスの メソッドをDeleteDataView使用して項目を削除します。

適用対象

こちらもご覧ください