emi_sastra
asked on
Close tabpage of custom control
Hi All,
I want to close certain or all tab pages.
How could I do this ?
Thank you.
I want to close certain or all tab pages.
How could I do this ?
Thank you.
Hi
When you say close I assume that you mean to remove?
In which case -
TabControl1.TabPages.Remov e(TabPage1 )
Will work
Good luck
When you say close I assume that you mean to remove?
In which case -
TabControl1.TabPages.Remov
Will work
Good luck
ASKER
What's the point of your code? I don't see where you've overridden the Remove function, so it should work as suggested.
ASKER
I have tried this.
For tpIndex = 0 To tc.TabPages.Count - 1
tc.TabPages.RemoveAt(tpInd ex)
Next
An unhandled exception of type 'System.ArgumentOutOfRange Exception' occurred in System.Windows.Forms.dll
Additional information: Index 2 is out of range.
Thank you.
For tpIndex = 0 To tc.TabPages.Count - 1
tc.TabPages.RemoveAt(tpInd
Next
An unhandled exception of type 'System.ArgumentOutOfRange
Additional information: Index 2 is out of range.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here is how I add tab page.
Dim tbp As New TabPage.
tbcERPMain.TabPages.Add(tb p)
tbp.Controls.Add(form)
tbcERPMain.SelectedTab = tbp
Thank you.
Dim tbp As New TabPage.
tbcERPMain.TabPages.Add(tb
tbp.Controls.Add(form)
tbcERPMain.SelectedTab = tbp
Thank you.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi All,
It works.
Thank you very much for your help.
It works.
Thank you very much for your help.
YourTabControl.TabPages.Re
You can also use the TabPage Name:
YourTabControl.TabPages.Re
Note that "tpCustomer" is the name of one of my TabPages. It is not a string value, so it's not enclosed in quotes.
See here for more information: https://msdn.microsoft.com/en-us/library/zb7xae05(v=vs.110).aspx