BindingManagerBase.RemoveAt(Int32) メソッド

定義

派生クラスでオーバーライドされると、基になるリストから指定されたインデックスに対応する行を削除します。

public:
 abstract void RemoveAt(int index);
public abstract void RemoveAt (int index);
abstract member RemoveAt : int -> unit
Public MustOverride Sub RemoveAt (index As Integer)

パラメーター

index
Int32

削除する行のインデックス。

例外

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

void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   try
   {
      // Get the 'BindingManagerBase' Object*.
      BindingManagerBase^ myBindingManagerBase = BindingContext[ myDataTable ];

      // Remove the selected row from the grid.
      myBindingManagerBase->RemoveAt( myBindingManagerBase->Position );
   }
   catch ( Exception^ ex ) 
   {
      MessageBox::Show( ex->Source );
      MessageBox::Show( ex->Message );
   }
}
private void button1_Click(object sender, System.EventArgs e)
{
   try
   {
      // Get the 'BindingManagerBase' object.
      BindingManagerBase myBindingManagerBase=BindingContext[myDataTable];
      // Remove the selected row from the grid.
      myBindingManagerBase.RemoveAt(myBindingManagerBase.Position);
   }
   catch(Exception ex)
   {
      MessageBox.Show(ex.Source);
      MessageBox.Show(ex.Message);
   }
}
Private Sub button1_Click(sender As Object, e As EventArgs)
   Try
      ' Get the 'BindingManagerBase' object.
      Dim myBindingManagerBase As BindingManagerBase = BindingContext(myDataTable)
      ' Remove the selected row from the grid.
      myBindingManagerBase.RemoveAt(myBindingManagerBase.Position)
   Catch ex As Exception
      MessageBox.Show(ex.Source)
      MessageBox.Show(ex.Message)
   End Try
End Sub

注釈

メソッドは RemoveAt 、基になるデータ ソースに依存して、メソッドの動作を決定します。 (サポートされているデータ ソースのBinding一覧については、 クラスを参照してください)。、、または を実装IBindingListIListするクラス、および ITypedListを実装IListRemoveAtする厳密に型指定されたクラスの場合、メソッドは実際にその内容を削除する代わりに、基になるリスト内の行を削除します。

基になるリストで インターフェイスが実装されている IBindingList 場合、 プロパティは を AllowRemove 返す true必要があります。 基になるリストで インターフェイスが実装されている IList 場合、 プロパティは を IsFixedSize 返す false必要があります。

適用対象

こちらもご覧ください