ControlBindingsCollection.RemoveAt(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在指定的索引處刪除 。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 小於 0,或大於集合中的綁定數。
範例
以下程式碼範例利用該 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 事件就會發生。