473,692 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2667
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.publi c.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.goo gle.com...
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.goo gle.com...
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.c om> wrote in message news:<eH******* *******@tk2msft ngp13.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.publi c.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.publi c.vsnet.ide or
microsoft.publi c.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_Hotm ail.com> wrote in message
news:ev******** ********@tk2msf tngp13.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.goo gle.com...
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.publi c.dotnet.framew ork and a
copy was sent to the cited author.]

In article <#G************ **@TK2MSFTNGP12 .phx.gbl>, x-code@no-spam-
please.hotpop.c om says...
Ken

It's actually a Visual Studio .NET issue that seems to be language
independent. I would agree that the microsoft.publi c.vsnet.ide or
microsoft.publi c.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
494
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 set to an instance of an object" Notes that: 1. It's a designer problem, not a reference problem. When I am adding this user control directly to the code it works just fine, but I can't make it
1
2952
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 Automation, communicate with the DB and/or WebServices, talk to other classes). To achieve a complicated task, this class would need reference to other custom assemblies (not part of .net framework) that are possibly not installed to the GAC. In my...
2
4089
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 query, I set the 2 primary key values equal to the 2 control values on my form. When I input a value to these 2 controls the query finds the correct record, so I know my query with the criteria works. My problem is trying to get the output values...
19
2976
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 provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
2
3172
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 problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
2
2584
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 good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
15
6511
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 accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
1
1979
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 picture boxes can be filled at design time. I want my custom control to act as container. I drag the controls from toolbox on my custom control. Everything is fine so far. But when i compile the application the two template controls i mentioned...
1
8363
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 instance of an object.'" I've traced the problem to a custom control I created that inherits from Inherits System.Windows.Forms.TextBox. In this custom control, I have two constructors. I'm not sure why I created the second constructor -- it was so...
0
8544
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8968
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8810
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6462
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5821
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4325
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4559
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1961
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.