Controlcontainer is .Net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry

    #1

    Controlcontainer is .Net

    I’m currently familiarizing myself with VB.net and right now I’m looking at
    the usercontrol. In VB6 it was possible for a usercontrol to act as a control
    container. However, I can’t find a property in .Net that would make it work
    similarly. When I look in the MSDN database, all I can find are documents
    relating to VB6.
    Please tell me a control container is still possible in .Net

  • Phill.  W

    #2
    Re: Controlcontaine r is .Net

    "Jerry" <Jerry@discussi ons.microsoft.c om> wrote in message
    news:096AE6F1-9C18-4EC6-B7AC-5EE695ACF166@mi crosoft.com...[color=blue]
    > In VB6 it was possible for a usercontrol to act as a control container.
    > However, I can't find a property in .Net that would make it work
    > similarly. When I look in the MSDN database, all I can find are documents
    > relating to VB6.
    > Please tell me a control container is still possible in .Net[/color]

    So you want to write a UserControl and then have other Controls
    placed "onto" or "into" the finished article?

    Look at the Modifiers on the UserControl and the other Controls
    within it. By default, these are Friend, so you can only change them
    within your UserControl's assembly. Change them to something more
    useful, like Protected (for Developers to use) or Public (for end users).

    HTH,
    Phill W.


    Comment

    • Jerry

      #3
      Re: Controlcontaine r is .Net

      Hi Phil,

      What I was looking for is basically a combination of a .Net usercontrol and
      a .Net panel control. Using the modifiers would give you access to controls
      that are placed on the usercontrol itself and not enable you to add controls
      to the usercontrol after the usercontrol has been placed on a form, right?

      My question has become a bit irrelevant, though. I was a bit stuck in VB6
      thinking and forgot about a bonus that .Net has. With inheritance I can
      basically do that what I wanted to use the contained controls for. It will
      mean more usercontrols in my project, but the forms will be cleaner.

      Thanks,

      Jerry

      Comment

      • Phill.  W

        #4
        Re: Controlcontaine r is .Net

        "Jerry" <Jerry@discussi ons.microsoft.c om> wrote in message
        news:30E3354D-E807-458F-A449-614B7D364032@mi crosoft.com...[color=blue]
        > What I was looking for is basically a combination of a .Net
        > usercontrol and a .Net panel control.[/color]

        You could just create your own Control /directly/ derived from Panel,
        if you wanted to.
        [color=blue]
        > Using the modifiers would give you access to controls that are placed
        > on the usercontrol itself and not enable you to add controls to the
        > usercontrol after the usercontrol has been placed on a form, right?[/color]

        Depends how you set them. IIRC, you can create a UserControl with
        a Panel on it (that fills all of the available area), set all the modifies
        to
        Public and you should be able to drop new Controls onto it, even at
        RunTime. I think.


        Comment

        Working...