Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TabControl: Delete TabPages causes an error

Status
Not open for further replies.

samsoysa

IS-IT--Management
Sep 18, 2001
17
AU
Hi,

I got a problem with a tabcontrol.

I uses a tabcontrol and creating tabpages and deleting them done programatically. When i delete pages I get an error saying "Specified argument was out of range of valid values ...". Can anyone help me on this.

Thanks in advance,

Samantha
 
It sounds like you are trying to delete a TabPage that doesn't exist.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
It happened when I tried deleting the 5th Tabpage.

Situ:
I got over 6 tabpages. I closes them from the end ... and when it comes to the 5th or 4th, i get that error. If I close it from the begining then no problem.

 
How do you mean you "close them from the end" or "close them from the beginnning"?

If you mean you are closing them by referring to them like TabPage(4) then you may have a problem if you have deleted some as the other pages may have been renamed (i.e. TabPage(6) becomes TabPage(5) when one is deleted).

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Hi,

I got this issue sorted out, anyway this is what happened.

In my UI, I have tabcontrol and I generate tabpages as and when I need and given them names. When I close them, I just call tabcontrol1.tabpages.remove(mytabcontrol.selectedTab). This is working fine as far as I remove a tabpage in the left most and when the tabpage index is <> 5. I want to colse tabpages from right side and ended up getting the error, even when I want to close the fifth tabpage, I get the same error.

Resolution:
Before deleting the SelectedTab, change the selectdtab to a different one and then closes the tab (not the selected tab as the selected tab is now different).

Thanks for your respond ....


Sam



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top