If you are talking about WinForms, the only way to do it is to loop through all the controls on that tab page and disable them one by one. For example:
private void DisableTabPage(TabPage tbPg)
{
foreach (Control c in tbPg.Controls)
c.Enabled = false;
}
private void EnableTabPage(TabPage tbPg)
{
foreach (Control c in tbPg.Controls)
c.Enabled = true;
}
You would then call it in code with:
DisableTabPage(tabPage1);
EnableTabPage(tabPage1);
TabPage does have an
.Enabled
property but it doesn't do anything (I don't think it shows up in Intellisense, it also has a
.Visible
property that doesn't show up or do anything). Shame that in WinForms they don't have a way to do it.
However, if you are talking about WPF, then you can disable them using the
.IsEnabled
or
.IsVisible
property, but since you used the word TabPage instead of TabItem I'm guessing you are using WinForms.