ControlBindingsCollection.RemoveAt(Int32) 方法

定義

刪除在指定索引處的 Binding

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

參數

index
Int32

要移除之項目的以零為起始的索引。

例外狀況

index 值小於零,或大於集合中的繫結數。

範例

下列程式碼範例會使用 Count 屬性來判斷索引是否在集合的範圍內。 如果是,則會移除第三個 Binding

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如果移除成功,就會發生此事件。

適用於