Hi Suzanne,
The Windows Forms designer can indeed silently remove controls from a form.
This issue has been raised several times on these newsgroups (and I
experienced it myself just a week ago, see my REPRO post in the
microsoft.public.vsnet.ide newsgroup), but I am unaware whether there's a
patch or a workaround available. From my experience, before opening a form
with custom controls in the designer, ensure that:
a) The assembly with the controls has been successfully built
b) None of the controls throw an exception in their constructors (this also
causes the designer to remove the offending control from a form without a
word of warning)
c) No tasks like "You should rebuild ...." are on the Task List.
When a custom control still has been killed by the designer, open the form's
code view and examine the "Designer generated code" region. You'll most
likely see that the code creating and initializing the control is already
there, the designer has only removed code adding the custom control to the
container's (be it the form or a panel on a form) Controls collection. You
can manually restore the "status quo" and this should "resurrect" the
control.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Suzanne" <sjamesNO_SPAM@mhapensions.com> wrote in message
news:3ca13514.0311180243.166bd5ea@posting.google.c om...[color=blue]
> Hi all,
>
> I really hope someone out there can help me as I've been tearing my
> hair out on this one for a good while and I'm getting really
> frustrated now!
>
> My problem is this - my custom controls periodically disappear from my
> project when I build it. First of I get the message about a missing
> dependency, then if I rebuild after that - the control just physically
> disappears from the form, and I get an object not found error when I
> run, (though sometimes when I rebuild the control can reappear)
>
> My background - I'm working in a small team of developers, we are
> using vb.net in visual studio with visual source safe.
>
> As I've said I've been battling with this for a while and have done
> some reading on this - I know that it is to do with references.
> Therefore I am trying to do what all the Microsoft articles I've read
> recommend with regard to references: - setting copy to local = true,
> using project references not file references, and setting the build
> order but to no avail. (Incidentally I still get this problem when
> using file references).
>
> Some more information - the custom controls are using a data access
> object, and this data access object is also being used by another
> object which the main form also uses. It is the reference to this data
> access object that is the one that that I get the message about the
> missing dependency.
>
> Please help - now to add insult to injury - I can not now even re-add
> my custom control from the toolbox. I can put it into the toolbox but
> when I try to drag it from the toolbox on to the form on nothing
> happens- not even a warning message.
>
> Many thanks
> Suzanne[/color]