hiding of tabpages

Topics: CAB & Smart Client Software Factory
Oct 27, 2006 at 9:06 PM
originally posted by: arnab_74

Hi,
In my application I have added the tab workspace at design time and added a few tab pages.

Now, I need to in certain circumstances disable or not show some pages.

I tried :tabworkspace1.tabpages0.Hide();

But this did not work.

Could some one please tell me what to do.

Thanks
Arnab
Oct 28, 2006 at 9:55 AM
originally posted by: Jauwaad

I don't think the Hide() method of the TabPage works. Override the TabWorkspace or modify it to remove the page OnHide() and show the page OnShow()

Here is a sample of the overridden function, do the same for onshow.

protected override void OnHide(Control smartPart)
{
base.OnHide(smartPart);

if (this.Pages.ContainsKey(smartPart) )
{
string key = this.PagessmartPart.Name;
if(this.TabPages.ContainsKey(key))
this.TabPages.RemoveByKey(key);
}
}