Controls disappear from inherited usercontrol on compile

Controls disappear from inherited usercontrol on compile

Post by JM Server » Tue, 20 May 2003 23:16:36



Hi, I have a very strange problem with vsnet 2003, inner controls sometimes
disappear from the design view when I compile a project and the design view
of the control is visible.
It seems to delete the line: Controls.Add(this.mycontrol)

It is very easy to reproduce it, just follow this steps:
1.- Create a windows forms application
2.- Create a new usercontrol and compile
3.- Create an inherited usercontrol from the first one
4.- put a panel into the usercontrol2
5.- put a button into the panel
6.- now, without hiding the usercontrol2 do a build

tadaaaa! the button disappeared

Is it a known bug? I'm using a lot of inherited controls from many library
projects for my application and this behaviour is annoying.

Many thanx.
JM

 
 
 

Controls disappear from inherited usercontrol on compile

Post by JM Server » Thu, 22 May 2003 18:16:08


Hi again, I've found a little workaround for those who have the same
problem:
    place the usercontrols you are inheriting from into another solution and
do a library reference to it, instead of a project reference. This seems to
stop this bug.
May someone at microsoft confirm this bug?



Quote:> Hi, I have a very strange problem with vsnet 2003, inner controls
sometimes
> disappear from the design view when I compile a project and the design
view
> of the control is visible.
> It seems to delete the line: Controls.Add(this.mycontrol)

> It is very easy to reproduce it, just follow this steps:
> 1.- Create a windows forms application
> 2.- Create a new usercontrol and compile
> 3.- Create an inherited usercontrol from the first one
> 4.- put a panel into the usercontrol2
> 5.- put a button into the panel
> 6.- now, without hiding the usercontrol2 do a build

> tadaaaa! the button disappeared

> Is it a known bug? I'm using a lot of inherited controls from many library
> projects for my application and this behaviour is annoying.

> Many thanx.
> JM


 
 
 

1. Inherited groupbox's behavior - controls disappear...

    Hi,

I have a strange problem - may be somebody have seen it before:

I use VS.NET 2003 . I have a GroupBox defined as "protected" in some
UserControl class which
serve as a base class for the derived controls. When I try to add some other
control to this groupbox
using Designer, it first reacts appropriately - shows the new control inside
the groupbox, allows to move them
together etc., but after compiling this code the added control disappears.
Interesting that the line

this.groupBoxMain.Controls.Add(this.button1);

is still present in the InitializeComponent()  .

When you try to check if the added component exists in the
this.groupBoxMain.Controls collection the results is negative
(I added the line   bool contains = this.groupBoxMain.Controls.Contains(
this.button1); right after the InitializeComponent() ).
Finally, if you add this control to this groupbox manually after
InitializeComponent() - everything looks OK.
The questions is - where those controls disappear after being added in the
InitializeComponent()  without any error or
exception thrown, and is there any work around for this behavior.

Thanks a lot,
Dmitry.

2. Emulator for printing

3. Controls Disappears in Inherited forms

4. same problem on ICS

5. Question on how to Inherit from a .ascx file that Inherits from WebControls.UserControl...

6. dLibs and MicroEMACS sources

7. Inheriting web usercontrol from another web usercontrol

8. SSS

9. User Controls disappear when assembly doesnt compile

10. Placing controls on an inherited UserControl in Design Mode...

11. Inheriting from Control vs. UserControl

12. UserControl or Inherited Control?

13. My UserControls keep disappearing from Designer...