Hi,
I am trying to create a UserControl that mimics the Options screen from the Visual Studio (2008) IDE and many other programs: a list of all the 'sub-options' which give you the corresponding options when selected.
My idea was that it worked pretty much the same as a TabControl except that the 'tab headers' are now the list entries and the tabpages are simple Panels that get hidden/unhidden when they are needed.
Now, I want the user to be able to add options panels (or "Pages") from the designer so he doesn't have to do it via code obviously.
I created a Public Property called Pages() of type "Collection" that will hold the Pages (which are of another UserControl control type called "ctrlPage", inherited from the Panel control).
I can access this property from the designer, but I can only add 'Objects'. How can I specify that these Pages are actually of the type "ctrlPage" instead of just Object?
I have tried replacing the Collection with a "List(Of ctrlPage)" but that keeps giving me an error about Panels and ctrlPage not being serializable or something...
The pages property is just this:
Private _Pages As Collection
vb.net Code:
Public Property Pages() As Collection Get If _Pages Is Nothing Then _Pages = New Collection() Return _Pages End Get Set(ByVal value As Collection) _Pages = value End Set End Property




Reply With Quote