Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes a given button from the toolbar button collection.
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)
The indexed location of the ToolBarButton in the collection.
The index
value is less than 0, or it is greater than the number of buttons in the collection.
The following code example removes the last ToolBarButton on a ToolBar. The index value of the toolbar button being removed is set equal to the Count property, minus one, since the ToolBarButton collection is a zero-based index.
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
The Remove method removes the ToolBarButton at the specified location in the ToolBar.ToolBarButtonCollection. If you want to remove all ToolBarButton controls from the collection, use the Clear method.
Product | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Please sign in to use this experience.
Sign in