ComponentOne Menus and Toolbars for WinForms
Menus and Toolbars for WinForms Task-Based Help / DockingTab Tasks / Restricting the Usage of Specific Tabs
In This Topic
    Restricting the Usage of Specific Tabs
    In This Topic

    You can add a handler to the SelectedIndexChanging event to test whether the index of the page is the page that you don't want the user to switch to. If so, e.Cancel would be set to True. For example, the following code shows how to add a handler to the SelectedIndexChanging event:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Private Sub c1DockingTab1_SelectedIndexChanging(sender As Object, e As C1.Win.C1Command.SelectedIndexChangingEventArgs)
       If e.NewIndex = 1 And e.CanCancel Then
          e.Cancel = True
       End If
    End Sub
    

    To write code in C#

    C#
    Copy Code
    private void c1DockingTab1_SelectedIndexChanging(object sender, C1.Win.C1Command.SelectedIndexChangingEventArgs e)
    {
       if(e.NewIndex == 1 && e.CanCancel)
          e.Cancel = true;
    }
    
    See Also