ComponentOne Menus and Toolbars for WinForms
Menus and Toolbars for WinForms Task-Based Help / TopicBar Tasks / Adding and Removing TopicBar Items / Removing a Topic Page from the TopicBar
In This Topic
    Removing a Topic Page from the TopicBar
    In This Topic

    There are three ways to remove a page from the topic bar: you can use the floating toolbar, the collection editor, or code. In this topic, you will learn how to remove pages from the topic bar using each of these three methods.

    Using the Floating Toolbar

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon. The C1TopicBar control is added to the form. Observe that one page, named Page 1, appears on the control by default. If you'd like to add more pages to the control, see Adding Topic Pages to the TopicBar.
    2. Hover over Page 1 with your cursor until the floating toolbar appears. The topic page's toolbar appears as follows:
      Toolbar
    3. Click the Delete topic page button Button.

    The topic page is removed from the control.

    Using the Collection Editor

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon. The C1TopicBar control is added to the form. Observe that one page, named Page 1, appears on the control by default. If you'd like to add more pages to the control, see Adding Topic Pages to the TopicBar.
    2. Click C1TopicBar's smart tag (Smart tag) to open the C1TopicBar Tasks menu.
    3. On the C1TopicBar Tasks menu, click Edit Pages.
      Tasks menu
      The C1TopicPage Collection Editor opens.
    4. In the Members pane, select the page you wish to remove.
    5. Click Remove to remove the page.
    6. Click OK to close the C1TopicPage Collection Editor.

    The page is removed from the control.

    Using Code

    Complete the following steps:

    1. Navigate to the Toolbox and double-click the C1TopicBar icon. The C1TopicBar control is added to the form. Observe that one page, named Page 1, appears on the control by default. If you'd like to add more pages to the control, see Adding Topic Pages to the TopicBar.
    2. Click C1TopicBar's smart tag () to open the C1TopicBar Tasks menu.
    3. On the C1TopicBar Tasks menu, click Edit Pages.
      Edit Pages
      The C1TopicPage Collection Editor opens.
    4. Select the page you wish to remove and then set its Tag property to “Tag1”. Adding this tag gives the page a unique indicator that will allow you to find it later using the FindPageByTag method.
    5. Click OK to close the C1TopicPage Collection Editor.
    6. Double-click the empty portion of the form to open Code view. Notice that a Form_Load event handler has been added to Code view.
    7. Add the following code, which finds the page and then removes it, to the Form_Load event:

      To write code in Visual Basic

      Visual Basic
      Copy Code
      'Find the page and assign it to a variable
      Dim Page1 = c1TopicBar1.FindPageByTag("Tag1")
      'Remove the specified page
      c1TopicBar1.Pages.Remove(Page1)                                
      

      To write code in C#

      C#
      Copy Code
      //Find the page and assign it to a variable
      var Page1 = c1TopicBar1.FindPageByTag("Tag1");
      //Remove the specified page
      c1TopicBar1.Pages.Remove(Page1);                                
      
    8. Press F5 to build the project and observe that the page has been removed.
    See Also