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. Visual Basic
  4. Control Designer & Child Controls Issue

Control Designer & Child Controls Issue

Scheduled Pinned Locked Moved Visual Basic
helpdesignquestion
1 Posts 1 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.
  • S Offline
    S Offline
    scott otech com
    wrote on last edited by
    #1

    Does anyone have a solution to this problem: :confused::confused::confused: When implementing a ControlDesigner or ParentControlDesigner, if one has a UserControl that contains child controls as follows: +========UserControl=========+ | +-----------------------------------+ | | | Caption Panel | | | +-----------------------------------+ | | +---------------------------------- + | | | Content Panel | | | +-----------------------------------+ | +=========================+ My desire is to have ToolboxItems that are added to the UserControl at design-time be added as children of the ContentPanel. - Using a ControlDesigner and invoking CreateComponent() adds the control to the current design document (the UserControl). - If one attempts to "re-parent" the control being "dropped" within the designer for the UserControl by doing the following Control target = ((myUserControl)this.Control).ContentPanel; // the (child) Control where the dropped control should be moved-to this.Control.Controls.RemoveAt(this.Control.Controls.IndexOf(ctl)); // remove the control from the UserControl (top-level parent) ctl.Parent = target; // assign the .Parent property of the control target.Controls.Add(ctl); // add the dropped control to the ContentPanel Controls collection The error "Object reference not set to an instance of an object" occurs. Do I need to create a(nother) designer for the ContentPanel so that IT can serve as the target of the DragDrop? Is there some other (more expedient) way to do this? Initiate an additional DesignerTransaction that makes the re-parenting change? Making the .Parent and Controls[] change, and then using the ComponentChangeService to make Changing/Changed notifications on the "Parent" and "Controls" PropertyDescriptors ?

    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