Hi,
I am trying to add my user control into the toolbox then onto my form. Every time I try it tells me it cannot create an instance of the control, one of the controls dependancies could not be found.
Any ideas?
Printable View
Hi,
I am trying to add my user control into the toolbox then onto my form. Every time I try it tells me it cannot create an instance of the control, one of the controls dependancies could not be found.
Any ideas?
what kind of a user control is it?is it a web user control(ascx) or a windows user control?
It is a Windows control...it basically says a library I reference inside the control isn't compiled or something, but it is fine...
The Toolbox is somewhat weak in VS.NET 2003.
This thing can happen because of many reasons: run-time bug in the constuctor of the user control, reference that is not in the correct location, and so on.
I suggest to do the following steps:
1. Add the reference to the library with control ourself.
2. Add the control by code (not from the designer):
3. put a breakpoint on that line of code. Step into the constructor of the control and try to find bugs.Code:YourUserControl uc = new YourUserControl();
Well that is the weird thing...I added the control by hand previously after I got this error and I haven't found any bugs yet...
Well before using the user control there are few things which you should take care of..
1. If you are developing the User Control in the same project, then before using it you need to build the project first.
2. If you have the user control in the separate project, make sure that you have added the reference to that assembly prior to using it.
3. There is no need to add a user control to the Toolbox, it will automatically be added under My User Controls tab once you build your project.
4. If you do any change in the source of your user control, make sure you re-build the porject and then use a new instance of the user_control..
HTH
Yes I have the control in the same project as the form I am dropping it on.
I build the project before the attempt - but my user controls are never added automatically to the 'My User Controls' part of the toolbox??
All the references are fine I am positive of that - I add other user controls just fine the same way but this one won't let me do it. I can add it programmatically and use it but then if I make a change to the form it disappears on me.
I got the control added...the suggestion about cleaning up the constructor helped...thanks for all your suggestions!