BindingManagerBase.RemoveAt(Int32) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
When overridden in a derived class, deletes the row at the specified index from the underlying list.
public:
abstract void RemoveAt(int index);
public abstract void RemoveAt (int index);
abstract member RemoveAt : int -> unit
Public MustOverride Sub RemoveAt (index As Integer)
Parameters
- index
- Int32
The index of the row to delete.
Exceptions
There is no row at the specified index
.
Examples
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
Remarks
The RemoveAt method relies on the underlying data source to determine how the method behaves. (See the Binding class for a list of supported data sources.) For classes that implement IList, IBindingList, or ITypedList, as well as strongly typed classes that implement IList, the RemoveAt method actually deletes the row in the underlying list instead of removing its contents.
If the underlying list implements the IBindingList interface, the AllowRemove property must return true
. If the underlying list implements the IList interface, the IsFixedSize property must return false
.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기