Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. UserControl and how to add controls to it

UserControl and how to add controls to it

Scheduled Pinned Locked Moved C#
designtutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Boaz V
    wrote on last edited by
    #1

    Hi, i've built a UserControl which has a panel in it, I wish to be able to add controls into it at design-time. I've tried to do it simple; just built the control, compiled it into a DLL and add it to the ToolBox, then i've drag it to my WinForm. The control is visible and all its properties are working great. but when i try to add a control into it (say a link labal), the control does not get added! i see the outlines selections, with nothing inside (i.e. the text, color etc.) and when compiling and running the WinForm, the link does not appear. any idea? thanks guys

    B S H 4 Replies Last reply
    0
    • B Boaz V

      Hi, i've built a UserControl which has a panel in it, I wish to be able to add controls into it at design-time. I've tried to do it simple; just built the control, compiled it into a DLL and add it to the ToolBox, then i've drag it to my WinForm. The control is visible and all its properties are working great. but when i try to add a control into it (say a link labal), the control does not get added! i see the outlines selections, with nothing inside (i.e. the text, color etc.) and when compiling and running the WinForm, the link does not appear. any idea? thanks guys

      B Offline
      B Offline
      Boaz V
      wrote on last edited by
      #2

      Hi guys, it me again. I've looked at MS KB 813450, and it didn't fix my problem. which is realy weird... maybe i'm doing something wrong?

      B 1 Reply Last reply
      0
      • B Boaz V

        Hi guys, it me again. I've looked at MS KB 813450, and it didn't fix my problem. which is realy weird... maybe i'm doing something wrong?

        B Offline
        B Offline
        Boaz V
        wrote on last edited by
        #3

        Hi guys, I've identified the problem. In my UserControl, i have a panel which is fill-docked on it. when i remove it and try the KB 813450 solution, it works. but i want to keep that panel. any idea? thanks

        1 Reply Last reply
        0
        • B Boaz V

          Hi, i've built a UserControl which has a panel in it, I wish to be able to add controls into it at design-time. I've tried to do it simple; just built the control, compiled it into a DLL and add it to the ToolBox, then i've drag it to my WinForm. The control is visible and all its properties are working great. but when i try to add a control into it (say a link labal), the control does not get added! i see the outlines selections, with nothing inside (i.e. the text, color etc.) and when compiling and running the WinForm, the link does not appear. any idea? thanks guys

          S Offline
          S Offline
          sreejith ss nair
          wrote on last edited by
          #4

          hai there, I think the above mentioned steps are that you following to build your application. am i right ?. If yes it won't show any unexpected out put. The way that you are following is correct. I think the problem is because of properties of controls that you are using here. I tried this same thing and i never found any problem. If you want code block that i tried.then please let me know. hai, enjoy coding Sreejith SS Nair

          1 Reply Last reply
          0
          • B Boaz V

            Hi, i've built a UserControl which has a panel in it, I wish to be able to add controls into it at design-time. I've tried to do it simple; just built the control, compiled it into a DLL and add it to the ToolBox, then i've drag it to my WinForm. The control is visible and all its properties are working great. but when i try to add a control into it (say a link labal), the control does not get added! i see the outlines selections, with nothing inside (i.e. the text, color etc.) and when compiling and running the WinForm, the link does not appear. any idea? thanks guys

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            The Panel should be either protected or public (by default, the VS.NET designer makes these private). If it is not, it is not a separately designable container - it's just another part of your UserControl. If you find that it does not work, you need to attribute your UserControl with a ParentControlDesigner derivative that allows controls to be added. You can find out more about this designer class in the .NET Framework SDK. Both suggestion should work, however. I helped another guy with a similar problem about a month ago and the problem was resolved using one (or both) of these methods. You could always try searching the comments (see the "Search comments" link ago) for keywords like "ParentControlDesigner" for more information on that discussion.

            Microsoft MVP, Visual C# My Articles

            1 Reply Last reply
            0
            • B Boaz V

              Hi, i've built a UserControl which has a panel in it, I wish to be able to add controls into it at design-time. I've tried to do it simple; just built the control, compiled it into a DLL and add it to the ToolBox, then i've drag it to my WinForm. The control is visible and all its properties are working great. but when i try to add a control into it (say a link labal), the control does not get added! i see the outlines selections, with nothing inside (i.e. the text, color etc.) and when compiling and running the WinForm, the link does not appear. any idea? thanks guys

              B Offline
              B Offline
              Boaz V
              wrote on last edited by
              #6

              Thanks guys for the quick help. the fixed the problem by removing the panel that was fill-docking my user control and adding the ParentControlDesigner attribute. Now the controls are being added into the user control and not to one of its controls (i.e. the panel i wanted it to be added to). thanks.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups