Tabpage add/remove

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I knew that "Hide" doesn't work with Tabpage if I want to hide it. I should
use Remove/Add. But I have some other controls in the tabpage which I don't
want to use code to dynamiclly create them. If I use remove to remove that
tabpage and later use add to add it back in, I have to write code to create
all the controls inside that tabpage, otherwise it will be a blank page.
What can I do to avoid it? Thank you for your time and help.
 
I knew that "Hide" doesn't work with Tabpage if I want to hide it. I should
use Remove/Add. But I have some other controls in the tabpage which I don't
want to use code to dynamiclly create them. If I use remove to remove that
tabpage and later use add to add it back in, I have to write code to create
all the controls inside that tabpage, otherwise it will be a blank page.
What can I do to avoid it? Thank you for your time and help.

Instead completly removing the TabPages use some kind of a TabPageManager.
This TabPageManager is a class having a collection of all your TabPages.
When you have to show a TabPage you get it from the TabPageManager and add
it to the TabControl. So if you remove a TabPage from the TabControl it
still exists in the TabPageManager. So the next time you have to show the
removed TabPage you get it again from the TabPageManager and add it to the
TabControl.

hth
 
Back
Top