I am making an event to check if specific tab page in a tab control is active.
The point is, it will trigger an event if that tab page in a tab control is the curren
I think that using the event tabPage1.Enter is more convenient.
tabPage1.Enter += new System.EventHandler(tabPage1_Enter);
private void tabPage1_Enter(object sender, EventArgs e)
{
MessageBox.Show("you entered tabPage1");
}
This is better than having nested if-else statement when you have different logic for different tabs. And more suitable in case new tabs may be added in the future.
Note that this event fires if the form loads and tabPage1 is opened by default.