Controls disappearing from WinForm.

  • Thread starter Thread starter Frank Rizzo
  • Start date Start date
F

Frank Rizzo

Hello, I have a form that contains the Browser control (via interop, of
course) among other things. The browser control is in a Panel control.
When I add other controls (such as splitter and some others), the
controls seem to randomly either disappear or move to different Panels,
etc... For instance, I've sized the browser to 100x100 and it will
resize itself to a much larger size. Then I'll add a splitter after
several trips to code and then to the forms designer, the splitter will
just disappear. Closer code inspection reveals that in the code that's
generated by the windows designer, the splitter control is removed from
the this.Controls.Add(...) statement. And the browser control simply
changes it's size (in code too).

What's going on? Has anyone experienced this?

Thanks
 
Frank,

I've been having this problem for quite some time, and that's why I'm poking
around here -- looking for some answers.

Here's what I've been seeing. When I open VS and open my form, my controls
are there and all's well. When I hit F5 to run the app and then close it to
return to VS, I get numerous error messages in the task list that say "Member
not found." That's the first sign that it deleted my controls. If I close
VS without saving those changes, I can reopen VS and my controls will still
be there until the next time I debug the app from VS. But if I miss those
messages and save the changes, VS will have removed the ...Controls.Add(xxx)
from the generated code.

VERY FRUSTRATING and a real productivity killer.

I'm hoping someone will reply and tell us there are some hotfixes for this
one!

Good luck!
Vince
 
Several possibilities, I would suggest you confirm it happens on another
installation of VS. Also check that you haven't manually added your own code
to add buttons etc.. to VS generated region of code.
 
Evan,

There are only 2 other developers here with me, but they both experience the
exact same thing and can reproduce the exact same scenario.

There's no manual code in the generated sections. We know to stay out of
there.

Thanks,
Vince
 
I figured out how to work around my problem! I read in a hotfix bulletin
that the "fixed" problem was isolated to C# and solutions that contain
multiple projects. Wel, I'm not going to port everything from C#, but I can
easily remove extra projects from my solution. When I removed all but the
main project, the controls stopped disappearing!

So obviously the hotfix that was supposed to fix this problem didn't fix it,
but the workaround takes care of it.

I hope this solution finds its way to others with this problem, and helps
them too, because WHAT A PAIN!

Thanks,
Vince
 
Back
Top