-
How to Hide TabPages dynamicaly
almost 10 years ago
-
almost 10 years ago
Hi Mayank,
The best solution I can suggest is that as you remove the TabPages from the Tab Control, keep the removed pages in the list so that you can get them later...Please go through the following example this will give you the exact idea I am talking about:
private List<TabPage> removedPages = new List<TabPage>(); private void EnablePage(TabPage page, bool enable) { if (enable) { tabControl1.TabPages.Add(page); removedPages.Remove(page); } else { tabControl1.TabPages.Remove(page); removedPages.Add(page); } } protected override void OnFormClosed(FormClosedEventArgs e) { foreach (var page in removedPages) page.Dispose(); base.OnFormClosed(e); }
1 Answer(s)