Filling Control Collections at design time

Jarod

Regular
Joined
Feb 5, 2003
Messages
82
Location
Bruxelles
I have created my own TabPage control, inheriting from the "standard" Windows.Forms.TabPage

However, I would like to be able to choose it at design time when creating a TabControl.
For exemple when we create a TableStyle at design time, the collection wizard offers us the possibility to choose between the TextBoxColumns and the BoolColumns
Is there a way to do the same in my case?
Is there any attribute that I have to use in that case ?

Thanks,
 
I guess you would have to inherit from TabControl, make a new TabPages collection based on your own page, and even use your own designer to specify that the verbs use your pages when creating new ones.
 
Ok and I have seen that the TabPage (the standard one as my custom one) doesn't appear in the ToolBox when I try to customize it.
I think that this is normal as the TabPage can't be added in a container other than the TabControl.
But one other nice solution to my previous problem is to be able to Drag / Drop my custom TabPage in a TabControl (instead of adding "normal" TabPages end changing the generated code.

So is there a way to add a tabPage to the ToolBox ?
Thanks
 
Tabpages like menu items are children classes to the main contorl TabContol and MainMenu\Context menu respectfuly

So no, just change the creation of you tabpages to your class instead of the normal tabpage class in the form geration code

so instead of

Visual Basic:
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
Me.TabPage1 = New System.Windows.Forms.TabPage()

it becomes

Visual Basic:
Friend WithEvents TabPage1 As UserTabPage
Me.TabPage1 = New UserTabPage()

remember UserTabPage is the class name of your inherited tabpage class.

Andy
 
You could try appling a ToolBoxItem(True) attribute to your tabpage, then you might be able to persuade it to appear in the toolbox.
 
Back
Top