Search Results for

    Show / Hide Table of Contents

    Removing a Button

    This example outlines the steps to remove an existing CommandBarButton from a RibbonGroup and RibbonTab in RobotStudio. It builds upon the example provided in Creating a Button, assuming that MyFirstButton has already been created and added to the UI. This example does not require a station.

    Solution

    1. Get RibbonTab

      // Find and get the specified RibbonTab by its unique ID
      RibbonTab ribbonTab = UIEnvironment.RibbonTabs["MyTab"];
      
    2. Remove MyFirstButton from RibbonGroup and RibbonTab

      // Remove button with ID "MyFirstButton" from RibbonGroup "MyButtons"
      ribbonTab.Groups["MyButtons"].Controls.Remove("MyFirstButton");
      

    Example

    public void RemoveButton()
    {
        // Begin UndoStep
        Project.UndoContext.BeginUndoStep("RemoveButton");
    
        try
        {
            // Find and get the specified RibbonTab by its unique ID
            RibbonTab ribbonTab = UIEnvironment.RibbonTabs["MyTab"];
    
            // Remove button with ID "MyFirstButton" from RibbonGroup "MyButtons"
            ribbonTab.Groups["MyButtons"].Controls.Remove("MyFirstButton");
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }
    }
    

    Required Namespaces

    ABB.Robotics.RobotStudio.Environment

    See Also

    • Creating Button
    • Creating SplitButton
    In this article
    Back to top Copyright © 2026 ABB Robotics