BindingManagerBase.RemoveAt(Int32) Metódus

Definíció

Ha felülbírált egy származtatott osztályban, törli a megadott index sorát az alapul szolgáló listából.

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

Paraméterek

index
Int32

A törölni kívánt sor indexe.

Kivételek

A megadott indexhelyen nincs sor.

Példák

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

Megjegyzések

A RemoveAt metódus a mögöttes adatforrásra támaszkodik a metódus viselkedésének meghatározásához. (A támogatott adatforrások listáját az Binding osztályban találja.) Azokat az osztályokat, amelyek implementáljákIListIBindingList, illetve ITypedLista implementáltIList, erősen gépelt osztályokat, a RemoveAt metódus a tartalom eltávolítása helyett ténylegesen törli az alapul szolgáló lista sorát.

Ha az alapul szolgáló lista implementálja az IBindingList interfészt, a tulajdonságnak AllowRemove vissza kell adnia true. Ha az alapul szolgáló lista implementálja az IList interfészt, a tulajdonságnak IsFixedSize vissza kell adnia false.

A következőre érvényes:

Lásd még