|
On my form, I added a tab control, no biggie, then on the second tabpage in the collection of tabs, I add a tab control, looks good so far, total of 8 tabs (tabpages(0) through tabpages(7)), so far so good, now I have my max pages.
I have different levels of security as to who can use what tabs, so I now create me an arraylist, place all the tabs in the arraylist, and clean the tabpages from the tabcontrol collection.
Alright, this works, I use a select case statement to look at the securitylevel the user has, then fill the tabpages of the original tabcontrol with the pages that user will use.
No problem so far, or so I thought.
If I do not add the tabpage back to the tabcontrol that has the child tabcontrol on the tabpage, it won't let me close the application, can't use the X, can't use finalize, can't even dispose the app, have to end task.
*scratches his head*
So, I am like hmm.. I take the child control on the tabpage with the tabcontrol, get a collection of the controls on the tabpages in the tabcontrol, dispose them all, then dispose of all the tabs in this tabcontrol that sits on this tabpage, then finally dispose of the tabpage itself by removing it at location or just remove.
No joy.
Same problem, no error, just can't click the X or close the application.
I have no try/catch yet in place, this way I can see it throw the exceptions immediately, but the thing is, no exception is thrown, the application is still responding, working like a champ, but I just can't quit it.
Using another application I wrote similar to spy++, I walk through my applications window handles, see the handle of the control before I nuke the tab that contains the control, refresh the app after I remove the tab that contains it, and no more handle, heck, nothing that looks like it would be an issue.
Only solution I could come up with was to use another method to present the data on that tab and get rid of the tabcontrol that set on the tabpage, would have loved to left it there, gave me more options.
Well, not more options, just more room to work with the current options.
Anyone have any clue what caused this?
I was thinking of orphaned control, but there is no proof the control is orphaned.
|