Member Avatar for pilsdumps

Hi,

I've created a base user control from which I want to inherit to create custom controls. This control will be used for data entry and includes a tablelayoutpanel control and panels.

When I inherit from the base control, the derived control will not allow the dragging and dropping of controls from the toolbox. I know this is something to do with System.componentmodel (http://support.microsoft.com/kb/322222) but I can't seem to get it to work.

The base control comprises of

  • Tablelayoutpanel contains
  • First cell of tlp contains a Panel control

I want to be able to create a new user control, inherit from the base one as structured above and make the panel act as a container for further controls. At present, I receive the 'no drop' notification and the control has an icon of a padlock.

Can someone please help me out?

Many thanks

Member Avatar for pilsdumps

In case anyone is interested, I think I've resolved this myself.

Microsoft suggests against the use of visual inheritance because of debugging difficulties with the designer. However, I've not found any major ones apart from the one described here. It seems prudent to make any base user controls as simple as possible.

The answer to my problem is twofold;

Firstly, tablelayoutpanels do not support visual inheritance
http://msdn.microsoft.com/en-us/library/ms171689.aspx and hence derived controls cannot use base controls as containers.

Secondly, you need to make sure that controls within the base control have their modifier set to Protected or Public to enable derived controls to use them as containers. I had in fact amended the modifiers, but the point above meant that this had not worked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.