次の方法で共有


ControlBindingsCollection.RemoveAt メソッド

指定したインデックスの Binding を削除します。

Public Shadows Sub RemoveAt( _
   ByVal index As Integer _)
[C#]
public new void RemoveAt(intindex);
[C++]
public: void RemoveAt(intindex);
[JScript]
public hide function RemoveAt(
   index : int);

パラメータ

  • index
    削除する項目の 0 から始まるインデックス。

例外

例外の種類 条件
ArgumentOutOfRangeException index の値が 0 未満か、コレクション内のバインディング数を超えています。

解説

削除が成功すると、 CollectionChanged イベントが発生します。

使用例

[Visual Basic, C#, C++] インデックスがコレクションの範囲内にあるどうかを Count プロパティを使用して判断する例を次に示します。インデックスがコレクションの範囲内にあった場合は、3 番目の Binding オブジェクトが削除されます。

 
Private Sub RemoveThirdBinding()
    If textBox1.DataBindings.Count < 3 Then
        Return
    End If
    textBox1.DataBindings.RemoveAt(2)
End Sub

[C#] 
private void RemoveThirdBinding()
{
   if(textBox1.DataBindings.Count < 3) return;
   textBox1.DataBindings.RemoveAt(2);
}

[C++] 
private:
void RemoveThirdBinding()
{
   if(textBox1->DataBindings->Count < 3) return;
   textBox1->DataBindings->RemoveAt(2);
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

ControlBindingsCollection クラス | ControlBindingsCollection メンバ | System.Windows.Forms 名前空間