Dissable TabPage in Tab control

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
 
A

Andrej Radinger

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
 
M

Mike Weatherley

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top