views:

707

answers:

5

I am using visual inheritance and was wondering if there is a way to change the properties of inherited controls at design time, preferably in the form designer. If not, then in the designer code.

I have my control declared as Public in the base class. I can access it in the child form code, but not in the form designer. Is this just not possible?

A: 

You need to change your control visibility. Put the control property Modifiers on public and recompile the project and then you can change properties of the inherited control.

gbianchi
It seems to work only for certain controls, but not all and I can't understand why. On my base form I have a TabControl that within it is a ComboBox, a ToolStrip, and a DataGridView. All of them are set to Public, but I can only modify the properties of the ComboBox and not the other two controls.
Jeff Stock
+2  A: 

It seems to work only for certain controls, but not all and I can't understand why. On my base form I have a TabControl that within it is a ComboBox, a ToolStrip, and a DataGridView. All of them are set to Public, but I can only modify the properties of the ComboBox and not the other two controls.

I have no idea why this is.

Jeff Stock
The designers for ToolStrip and DGV just don't support it.
Hans Passant
+2  A: 

There are limitations placed within visual studio for visual inheritance. Unfortunately, derived forms\usercontrols cannot modify controls containing collections within the base, namely DataGridViewRows, ToolStrips, ListViewColumns, etc.

Microsoft Bug Report

There are ways around this in certain situations. Create a protected property in the base class that exposes the exact properties of the control you wish to modify (DataGridView.BackgroundColor, or ListView.Columns).

Your base form should be able access this property to change the components needed. I've done this for ListView.Columns, and DataGridView.rows successfully, however ToolStrip.Items would not work.

greggorob64
I got the same situation ,It worked for button but not for toolstripe.
Thunder
A: 

Bil'in was a Twitter abbrev for bilirubin. Boy is my face red. ;) I have a non-threatening hereditary condition called

qogxateo
A: 

that worked thanks, just needed to recompile

kyle