473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Reference problems & custom controls disappearing

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
6 2627
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
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
"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
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
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
[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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kam | last post by:
Hi! When I am trying to drag user controls or any controls from the Toolbox to a form in some of my projects I get a dialog messages: (Microsoft Deployment Environment) "Object reference not...
1
by: normd | last post by:
I have a text file which contains VB.NET code. The VB.NET code is actually a Class that can contain code, which simply displays a message box or does something more complicated (i.e Excel/Word...
2
by: neptune | last post by:
I built a form to access a query with a 2 field primary key. It should use 2 controls to find the unique record and display the other field values on the form. In the criteria section of the...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
2
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
1
by: rizwanahmed24 | last post by:
Hello i have created a custom control. i have placed two template controls on it. One is check box and second is picture box. The custom control also contain two picture boxes as property. These...
1
by: Don | last post by:
I'm getting the following exception displayed in the task list at design time for my project: "Code generation for property 'Controls' failed. Error was: 'Object reference not set to an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.