ToolBar.ToolBarButtonCollection.RemoveAt(Int32) Metoda

Definice

Odebere dané tlačítko z kolekce tlačítek na panelu nástrojů.

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)

Parametry

index
Int32

Indexované umístění objektu ToolBarButton v kolekci.

Implementuje

Výjimky

Hodnota index je menší než 0 nebo je větší než počet tlačítek v kolekci.

Příklady

Následující příklad kódu odebere poslední ToolBarButton z objektu ToolBar. Hodnota indexu odebraného tlačítka panelu nástrojů je nastavena na Count hodnotu rovna vlastnosti minus jedna, protože ToolBarButton kolekce je index založený na nule.

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

Poznámky

Metoda Remove odebere v ToolBarButton zadaném umístění v objektu ToolBar.ToolBarButtonCollection. Pokud chcete z kolekce odebrat všechny ToolBarButton ovládací prvky, použijte metodu Clear .

Platí pro

Viz také