I\'m building a Windows Forms application in C#. How do I trigger code when a certain tab on a tab menu is selected?
For selecting a specific tab, can it only be identified by 0, 1, 2, and not the tab name?
You can do this by adding the event listener to the actual tab rather than to the tab control.
If you had a tab called tabHistory, you could add the following line in the designer.
this.tabHistory.Enter += new System.EventHandler(this.tabHistory_Enter);
Then just add your method to catch the event.
private void tabHistory_Enter(object sender, EventArgs e)
{
MessageBox.Show("Hey! Ive got focus");
}