Connecting Tech Pros Worldwide Forums | Help | Site Map

Reference problems & custom controls disappearing

Suzanne
Guest
 
Posts: n/a
#1: Nov 20 '05
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

Dmitriy Lapshin [C# / .NET MVP]
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Reference problems & custom controls disappearing


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]

Ken Halter
Guest
 
Posts: n/a
#3: Nov 20 '05

re: Reference problems & custom controls disappearing


Since you crossposted to .Net groups, I assume that this is a VB.Net question.... unless
the group contains the word "dotnet", it's not a .Net group. This is a VB "Classic" group.
If it were VB5 or 6, I'd say you have a Binary Compatibility issue.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep it in the groups..


"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]


Suzanne
Guest
 
Posts: n/a
#4: Nov 20 '05

re: Reference problems & custom controls disappearing


"Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> wrote in message news:<eHW1YndrDHA.1084@tk2msftngp13.phx.gbl>...[color=blue]
> 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
>
> Dimitry,[/color]

thanks so much for your prompt reply - I will certainly do what you
suggest and just add the code back into the controls collection when I
come across this problem in the future (as I'm sure I will!).

My biggest worry was that I was doing something wrong with the
referencing - but I just couldn't understand what.

Anyway thanks again
Suzanne
Dmitriy Lapshin [C# / .NET MVP]
Guest
 
Posts: n/a
#5: Nov 20 '05

re: Reference problems & custom controls disappearing


Ken

It's actually a Visual Studio .NET issue that seems to be language
independent. I would agree that the microsoft.public.vsnet.ide or
microsoft.public.vsnet.general group can be more suitable, but it's just
everybody more often or not just doesn't know where to start to look for the
root of the problem.

--
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

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:ev%23tgaerDHA.2964@tk2msftngp13.phx.gbl...[color=blue]
> Since you crossposted to .Net groups, I assume that this is a VB.Net[/color]
question.... unless[color=blue]
> the group contains the word "dotnet", it's not a .Net group. This is a VB[/color]
"Classic" group.[color=blue]
> If it were VB5 or 6, I'd say you have a Binary Compatibility issue.
>
> --
> Ken Halter - MS-MVP-VB - http://www.vbsight.com
> Please keep it in the groups..
>
>
> "Suzanne" <sjamesNO_SPAM@mhapensions.com> wrote in message
> news:3ca13514.0311180243.166bd5ea@posting.google.c om...[color=green]
> > 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]
>
>[/color]

Suzanne
Guest
 
Posts: n/a
#6: Nov 20 '05

re: Reference problems & custom controls disappearing


Dmitriy,

sorry to bug you again but I've yet again had the same problem:
I get the file or assemblies not found error and then my custom
controls disappear. I've tried doing what you suggested and manually
insert the code back into the designer generated region, but VSS just
won't accept it and disappears the code that I have just added back in
every time that I try to rebuild.

What I'd like to know is why am I getting the file or assembly not
found error in the first place if I'm using project references, copy
local = true etc?

Also I'm a bit unclear about how adding the custom control to the
toolbox fits into all this file vs project references debate? I
suppose that I'm actually referencing a specific version of the custom
controls dll by adding it into the toolbox in the first place? When I
drag it from the toolbox onto my form does that mean I am then
referencing that specific version (by a file reference) even though I
am including the custom control as a project reference in my solution?
Could that be why I'm getting that error message?

Any thoughts on this would really help me out
Thanks so much
Suzanne
junk
Guest
 
Posts: n/a
#7: Nov 20 '05

re: Reference problems & custom controls disappearing


[This followup was posted to microsoft.public.dotnet.framework and a
copy was sent to the cited author.]

In article <#GmKYsqrDHA.2448@TK2MSFTNGP12.phx.gbl>, x-code@no-spam-
please.hotpop.com says...[color=blue]
> Ken
>
> It's actually a Visual Studio .NET issue that seems to be language
> independent. I would agree that the microsoft.public.vsnet.ide or
> microsoft.public.vsnet.general group can be more suitable, but it's just
> everybody more often or not just doesn't know where to start to look for the
> root of the problem.
>
>[/color]
I commend you for your help to Suzanne. Ken does not need to take a
fascist attitude, here.
Closed Thread


Similar Visual Basic .NET bytes