We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to find the WinForms Docking Manager control which is currently active in tabbed group?

Platform: WinForms |
Control: DockingManager |
Published Date: April 30, 2011 |
Last Revised Date: December 6, 2019

Tabbed group

DockTabControl has an event which name is SelectedIndexChanged can give the details about the currently active control in the DockTabbedGroup. DockTabControl has the SelectedTab property which give the current active control in the group.

The following code snippet explain the above concept,

C#

private void dockTabControl_SelectedindexChanging (object sender, EventArgs e)
{
   if(sender is DockTabControl)
   {
      DockTabControl tabcontrol = sender as DockTabControl;
      string str = (string)tabcontrol.Tag;
      //Checks whether the DockTabControl.Tag is left or right.
      if(tabcontrol.SelectedTab !=null)
      {
         if (str == "left")
            Console.WriteLine("Selected Control on the left : " + tabcontrol.SelectedTab.Text);
         else
            Console.WriteLine("Selected Control on the right : " + tabcontrol.SelectedTab.Text);
      }
   }
}

 

VB

Private Sub dockTabControl_SelectedindexChanging(ByVal sender As Object, ByVal e As EventArgs)
   If TypeOf sender Is DockTabControl Then
      Dim tabcontrol As DockTabControl = CType(IIf(TypeOf sender Is DockTabControl, sender, Nothing), DockTabControl)
      Dim str As String = CStr(tabcontrol.Tag)
      'Checks whether the DockTabControl.Tag is left or right.
      If Not tabcontrol.SelectedTab is Nothing Then
         If str = "left" Then
            Console.WriteLine("Selected Control on the left : " & tabcontrol.SelectedTab.Text)
         Else
            Console.WriteLine("Selected Control on the right : " & tabcontrol.SelectedTab.Text)
         End If
      End If
   End If
End Sub

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon