By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Reference problems & custom controls disappearing

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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" <sj***********@mhapensions.com> wrote in message
news:3c**************************@posting.google.c om...
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


Nov 20 '05 #2

P: n/a
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" <sj***********@mhapensions.com> wrote in message
news:3c**************************@posting.google.c om...
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

Nov 20 '05 #3

P: n/a
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote in message news:<eH**************@tk2msftngp13.phx.gbl>...
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,


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
Nov 20 '05 #4

P: n/a
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****************@tk2msftngp13.phx.gbl...
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" <sj***********@mhapensions.com> wrote in message
news:3c**************************@posting.google.c om...
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



Nov 20 '05 #5

P: n/a
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
Nov 20 '05 #6

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

In article <#G**************@TK2MSFTNGP12.phx.gbl>, x-code@no-spam-
please.hotpop.com says...
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.

I commend you for your help to Suzanne. Ken does not need to take a
fascist attitude, here.
Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.