Usercontrol with Panel, need to act as container in IDE

Posted on 2006-04-26
Medium Priority
Last Modified: 2008-02-01

I have a UserControl with a Label, docked to the top, and a Panel, docked to fill the rest of the control space.

Once the control is compiled and dropped onto a form I am unable to treat the Panel within the UserControl as a container, as i would be able to if i placed a Panel directly on the form, with a Label and another Panel within (same set up as the UserControl).

How would I go about enabling this functionality.

I have tried
    setting the Modifier for the Panel in the UserControl to Public
    inheriting from Panel rather than UserControl

Any and all information would be greatly appreciated
Question by:drabaecus
  • 3
  • 2

Expert Comment

ID: 16542166
Once you put your UserControl on a form, you can't get Control's inside.
Your control is independent entity for the form. It behaves like any other Control of .NET.

If you want to add something to the Panel, add it when designing the UserControl.

Or you can inherit from the UserControl and add something in the derived UserControl.


Author Comment

ID: 16542250
Even during design time? The Panel control itself, and others, allow you to drag drop controls into them whilst designing the form in the IDE.


Expert Comment

ID: 16542767
Even during design time.
You can add control to Panel only from UserControl designer.

If you put the UserControl on a form, you can add controls to the UserControl, but not to the Panel.

But you can do it in run time, if you want.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 16574846
No i need to do it at design time, and here is the solution i found.


Expert Comment

ID: 16575790

Like I wrote:
> Or you can inherit from the UserControl and add something in the derived UserControl.

Good luck!

Accepted Solution

GranMod earned 0 total points
ID: 16613058
Closed, 500 points refunded.
The Experts Exchange
Community Support Moderator of all Ages

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month16 days, 4 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question