Use TagbControl selected changed event instead, or you can also recognize the Enter event when the tab page is clicked in show the message box:
User Control:
namespace TestPropogateTabEvent
{
public partial class UserControlWithTab : UserControl
{
public UserControlWithTab()
{
InitializeComponent();
}
public delegate void TabSelectionEventHandler(object sender, EventArgs e);
public event TabSelectionEventHandler PropogateSelectionChange;
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (PropogateSelectionChange != null)
{
PropogateSelectionChange(sender, e);
}
}
}
}
Form Class:
namespace TestPropogateTabEvent
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
userControlWithTab1.PropogateSelectionChange += new UserControlWithTab.TabSelectionEventHandler(userControlWithTab1_PropogateSelectionChange);
}
void userControlWithTab1_PropogateSelectionChange(object sender, EventArgs e)
{
MessageBox.Show("Tab In User Control Pressed");
}
}
}
Thanks