I'm trying to work out some code for a tabControl in my program. I want the program to hide a specific button if the main tabIndex = 0 (the main tab). In the event, a new tab is open or selected it will display the button. When the user closes a specific tab, it will check if returned to the main tab the hide the button. Below is what i have coded. So far, it only works if i call it on form load.
if (this.tabControl1.SelectedIndex == 0)
{
btCloseReport.Visible = false;
}
else
btCloseReport.Visible = true;
Thanks
Dv