Dissable TabPage in Tab control

  • Thread starter Thread starter siedeveloper
  • Start date Start date
S

siedeveloper

Hi frnd,
Can you please suggest me a wayout to dissable a tabPage
in tabControl ?
Any suggestions or tips would be of great use.

Thanx
 
When you create TabControl and add pages they get default names like
TabPage1, TabPage2,....
Each of these TabPage elements is an object and you can control is
separatly.
So, to disable TabPage2 you should use: TabPage2.enable = False

Regards,

Andrej Radinger
 
The Enabled property on the individual tab pages does not work, so you need
to iterate through the controls collection of the tab page and disable each
child control e.g.

private void PageEnabled(Control MyTabPage, bool IsEnabled)
{
int intIndex;
for (intIndex = 0; intIndex < MyTabPage.Controls.Count; intIndex++)
{
MyTablePage.Controls[intIndex].Enabled = IsEnabled;
}
}

then just call the function

PageEnabled(tabPage1, false);

Hope this helps...
 
Back
Top