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 하세요.) 구현IListIBindingList하는 클래스 또는 ITypedList강력한 형식의 클래스뿐만 아니라 구현 IListRemoveAt 하는 클래스의 경우 메서드는 내용을 제거하는 대신 기본 목록의 행을 실제로 삭제합니다.

기본 목록에서 인터페이스를 IBindingList 구현하는 경우 속성이 AllowRemove 반환 true되어야 합니다. 기본 목록에서 인터페이스를 IList 구현하는 경우 속성이 IsFixedSize 반환 false되어야 합니다.

적용 대상

추가 정보