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.
Unfortunately, activation email could not send to your email. Please try again.

How to find the control which is currently active in 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

Article ID: Published Date: Last Revised Date: Platform: Control:
1260 04/30/2011 07/10/2014 Windows Forms DockingManager
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.