Sometimes I really despair. I am currently trying (note not succeeding) to produce a wrapper for the .NET 1.x Tab Control, which IMHO is woefully short of functionality. I was making some headway until I discovered a couple of interesting points
- If you add a TabPage taken from one TabPageCollection into another TabPageCollection it is removed from the first TabPageCollection. I can live with that. A nuisance but I can live with it.
- TabPageCollections are 0 based. Collections are 1 based. This makes utilising a Collection class instead of a TabPageCollection difficult because you have to remember to convert the indexes between the two all the time.
So a rather simple problem of producing one collection to keep track of visible and invisible PageTabs (by default the visible property is ignored but that's another story) suddenly starts to get a bit more complicated. I can't use a single TabPageCollection because adding any TabPages from the actual control's TabPages into my own TabPageCollection removes the TabPage from the tab control's TabPages. And using a standard collection also holds perils (which a 30 minute debugging session has revealed) as I have to remember to keep changing the index when referencing between TabPageCollections and standard collections.
My real gripe is why aren't ALL collections 1 based (or 0 based for that matter - I don't care which). Personally I think it is better to be illogical but consistant rather logical but inconsistant.
So now I am researching how to create a 0 based class.
The thing that annoys me is that all this takes time. Yes, I'll figure out how to create a 0 based collection class, probably learning some useful points along the way but as with the great majority of my .NET projects I am in danger of losing interest in it because it is taking way too long to create something useful.
OK, I'll tuck my soapbox away, pour myself a beer and start looking into creating a 0 based collection class. If anyone has already created a 0 based collection class or knows where the code for one is please let me know. I have little interest in re-inventing the wheel in this particular instance. I'm more interested in getting my TabControlExtensions class up and running :)