ControlBindingsCollection.RemoveAt(Int32) ControlBindingsCollection.RemoveAt(Int32) ControlBindingsCollection.RemoveAt(Int32) ControlBindingsCollection.RemoveAt(Int32) Method

定义

删除指定索引处的 BindingDeletes the Binding at the specified index.

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

参数

index
Int32 Int32 Int32 Int32

要移除的项的从零开始的索引。The zero-based index of the item to remove.

异常

index 值小于 0 或大于集合中的绑定数。The index value is less than 0, or it is greater than the number of bindings in the collection.

示例

下面的代码示例使用Count属性来确定索引是否在集合的范围内。The following code example uses the Count property to determine whether the index is within the range of the collection. 如果是, 则删除Binding第三个。If so, the third Binding is removed.

private:
   void RemoveThirdBinding()
   {
      if ( textBox1->DataBindings->Count < 3 )
      {
         return;
      }
      textBox1->DataBindings->RemoveAt( 2 );
   }
private void RemoveThirdBinding()
{
   if(textBox1.DataBindings.Count < 3) return;
   textBox1.DataBindings.RemoveAt(2);
}
Private Sub RemoveThirdBinding()
    If textBox1.DataBindings.Count < 3 Then
        Return
    End If
    textBox1.DataBindings.RemoveAt(2)
End Sub

注解

如果CollectionChanged删除成功, 则会发生该事件。The CollectionChanged event occurs if the removal succeeds.

适用于