ToolBar.ToolBarButtonCollection.RemoveAt(Int32) メソッド

定義

ツール バー ボタン コレクションから指定したボタンを削除します。

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

パラメーター

index
Int32

コレクション内の ToolBarButton のインデックス位置。

実装

例外

index の値が 0 未満か、コレクション内のボタン数を超えています。

次のコード例では、 のToolBar最後ToolBarButtonの を削除します。 コレクションは 0 から始まるインデックスであるためToolBarButton、削除するツール バー ボタンのインデックス値は、 プロパティから 1 を引いた値に設定Countされます。

public:
   void RemoveMyButton()
   {
      int btns;
      btns = toolBar1->Buttons->Count;
      
      // Remove the last toolbar button.
      toolBar1->Buttons->RemoveAt( btns - 1 );
   }
public void RemoveMyButton()
 {
    int btns;
    btns = toolBar1.Buttons.Count;
 
    // Remove the last toolbar button.
    toolBar1.Buttons.RemoveAt(btns - 1);
 }
Public Sub RemoveMyButton()
    Dim btns As Integer
    btns = toolBar1.Buttons.Count
    
    ' Remove the last toolbar button.
    toolBar1.Buttons.RemoveAt(btns - 1)
End Sub

注釈

メソッドは Remove 、 内の ToolBarButton 指定した場所にある を削除します ToolBar.ToolBarButtonCollection。 コレクションからすべての ToolBarButton コントロールを削除する場合は、 メソッドを使用します Clear

適用対象

こちらもご覧ください