M
Mark Olbert
I have a custom usercontrol which itself contains various other controls (e.g., textboxes).
When I add an instance of that custom control to a form, it "looks" just like it did in its own
designer.
But when I compile the application, the instance of the custom control on the form suddenly includes
duplicates of all the child controls that were included in the custom control's design.
Looking at the InitializeComponent() code shows that the custom control gets created and then later
added to the form's control collection:
this.giver_rec2 = new Test.giver_rec();
....
this.Controls.Add(this.giver_rec2);
But, in between those calls, when the custom control itself is being initialized, the following line
appears:
this.giver_rec2.Controls.Add(new DBFrameworkTextBox("lookup_key"));
which, of course, creates the duplicate control inside the custom control instance.
Has anyone run into this before?
- Mark
When I add an instance of that custom control to a form, it "looks" just like it did in its own
designer.
But when I compile the application, the instance of the custom control on the form suddenly includes
duplicates of all the child controls that were included in the custom control's design.
Looking at the InitializeComponent() code shows that the custom control gets created and then later
added to the form's control collection:
this.giver_rec2 = new Test.giver_rec();
....
this.Controls.Add(this.giver_rec2);
But, in between those calls, when the custom control itself is being initialized, the following line
appears:
this.giver_rec2.Controls.Add(new DBFrameworkTextBox("lookup_key"));
which, of course, creates the duplicate control inside the custom control instance.
Has anyone run into this before?
- Mark