Articles in this section
Category / Section

How to notify the selected tab changes in WinForms TabbedMDIManager?

1 min read

Notify the selected tab changes in TabbedMDIManager

In TabbedMDIManager, TabControlAdv has been used internally to display the items in Tabbed structure. SelectedIndexChanged event of TabControlAdv is used to notify the tab selection in TabbedMDIManager. The following code snippet demonstrates the same, 

C#

public partial class Form1 : Form
{
  public Form1()
  {
    InitializeComponent();
    this.tabbedMDIManager1.TabControlAdded += TabbedMDIManager1_TabControlAdded;
  }
  private TabControlAdv tabcontrol = null;
  private void TabbedMDIManager1_TabControlAdded(object sender, Syncfusion.Windows.Forms.Tools.TabbedMDITabControlEventArgs args)
  {
    tabcontrol = args.TabControl;
    tabcontrol.SelectedIndexChanged += Tabcontrol_SelectedIndexChanged;
  }
  private void Tabcontrol_SelectedIndexChanged(object sender, EventArgs e)
  {
    Console.WriteLine(tabcontrol.SelectedTab.Text + "is Selected");
  }
}

VB

Partial Public Class Form1
  Inherits Form
  Public Sub New()
    InitializeComponent()
    AddHandler Me.tabbedMDIManager1.TabControlAdded, AddressOf TabbedMDIManager1_TabControlAdded
  End Sub
  Private tabcontrol As TabControlAdv = Nothing
  Private Sub TabbedMDIManager1_TabControlAdded(ByVal sender As Object, ByVal args As Syncfusion.Windows.Forms.Tools.TabbedMDITabControlEventArgs)
    tabcontrol = args.TabControl
    AddHandler tabcontrol.SelectedIndexChanged, AddressOf Tabcontrol_SelectedIndexChanged
  End Sub
  Private Sub Tabcontrol_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    Console.WriteLine(tabcontrol.SelectedTab.Text + "is Selected")
  End Sub
End Class

Samples:

C#: https://www.syncfusion.com/downloads/support/directtrac/general/ze/CSharp_TabbedMDIManager_Notify_event752758519.zip

VB: https://www.syncfusion.com/downloads/support/directtrac/general/ze/VB_TabbedMDIManager_Notify_event587455476.zip

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied