J
JG
Hi,
I have a windows form with a TabControl on it. It has 3 tabpages on it. I
have also coded a button that is supposed to 'add' a new tabpage.
The code in that clicked event looks like this:
tabPage tpNew = new TabPage("TabPage4");
this.tabControl1.TabPages.Add(tpNew);
tpNew.Controls.Add(this.label1);
No problem. It works just fine and adds the new tabpage to tabControl1. Note
in that tabpage that a label is also added. This too works just fine.
Now my question is this: how do I despose of that 'new' tabpage. I have
coded another button on my test winform and it desposes of the tabpages on
tabControl. It looks something like this:
tabPage2.Dispose();
tabPage3.Dispose();
Now, how do I dispose of the tabpage that I have added in the code above? I
have tried several things, but cannot get that one to go away...
Any help would be greately appreciated. Regards,
joe
I have a windows form with a TabControl on it. It has 3 tabpages on it. I
have also coded a button that is supposed to 'add' a new tabpage.
The code in that clicked event looks like this:
tabPage tpNew = new TabPage("TabPage4");
this.tabControl1.TabPages.Add(tpNew);
tpNew.Controls.Add(this.label1);
No problem. It works just fine and adds the new tabpage to tabControl1. Note
in that tabpage that a label is also added. This too works just fine.
Now my question is this: how do I despose of that 'new' tabpage. I have
coded another button on my test winform and it desposes of the tabpages on
tabControl. It looks something like this:
tabPage2.Dispose();
tabPage3.Dispose();
Now, how do I dispose of the tabpage that I have added in the code above? I
have tried several things, but cannot get that one to go away...
Any help would be greately appreciated. Regards,
joe