Usercontrol with Panel, need to act as container in IDE

Posted on 2006-04-26
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
    LVL 8

    Expert Comment

    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

    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.

    LVL 8

    Expert Comment

    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.

    Author Comment

    No i need to do it at design time, and here is the solution i found.
    LVL 8

    Expert Comment


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

    Good luck!

    Accepted Solution

    Closed, 500 points refunded.
    The Experts Exchange
    Community Support Moderator of all Ages

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    729 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now