PC Review


Reply
Thread Tools Rate Thread

It's not possible to call method in a class library dll from a user control dll

 
 
Tony Johansson
Guest
Posts: n/a
 
      2nd Apr 2006
Hello!

I have one solution file that consist of three project.
One project that build the exe file called A
One project that build a user control dll. Here we have a class called B
One project that build a class library dll. Here we have a class called C

We have one dependency and that is from the user control to the class
library because
in the constructor for class B in the user control we have a call to
instansiate class C in the class library dll.
public B()
{
InitializeComponent();
Last.C last = new Last.C();
last.foo();
}

In the project that create the exe file I have a project reference to the
user control.
In the project that create the user control I have a project reference to
the class library.

When I add the user control to the Toolbox I use the obj/debug directory to
select the user control dll.

Now to my problem when I try to drag the user control from the toolbox into
a form I get the following error "An exception occured while trying to
create an instance of WindowsControlLibrary.B. The execption was "?"."

Is this kind of a bug that cause this problem.
Is it possible to solve this kind of problem in some way.
I have even rebuild the user control dll and the class library dll but it
doesn't matter.


//Tony


I just wonder what is the requirement about the dll and its version on the
dll

I noticed that when I get error









 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      2nd Apr 2006
Hi Tony,

The problem doesn't stem from the fact that the User Control assembly
references the assembly it depends on, and that the executable references
the User Control assembly. I know that for a fact because I have done this
many times. What I don't know is what caused the error.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Tony Johansson" <(E-Mail Removed)> wrote in message
news:93UXf.50730$(E-Mail Removed)...
> Hello!
>
> I have one solution file that consist of three project.
> One project that build the exe file called A
> One project that build a user control dll. Here we have a class called B
> One project that build a class library dll. Here we have a class called C
>
> We have one dependency and that is from the user control to the class
> library because
> in the constructor for class B in the user control we have a call to
> instansiate class C in the class library dll.
> public B()
> {
> InitializeComponent();
> Last.C last = new Last.C();
> last.foo();
> }
>
> In the project that create the exe file I have a project reference to the
> user control.
> In the project that create the user control I have a project reference to
> the class library.
>
> When I add the user control to the Toolbox I use the obj/debug directory
> to select the user control dll.
>
> Now to my problem when I try to drag the user control from the toolbox
> into a form I get the following error "An exception occured while trying
> to create an instance of WindowsControlLibrary.B. The execption was "?"."
>
> Is this kind of a bug that cause this problem.
> Is it possible to solve this kind of problem in some way.
> I have even rebuild the user control dll and the class library dll but it
> doesn't matter.
>
>
> //Tony
>
>
> I just wonder what is the requirement about the dll and its version on the
> dll
>
> I noticed that when I get error
>
>
>
>
>
>
>
>



 
Reply With Quote
 
Tony Johansson
Guest
Posts: n/a
 
      2nd Apr 2006
Hi!

When I have this kind of problem what is the solution?
If I put the class library in the GAC that is called by the user control
would that solve my problem?

Do you think that this could be a bug because you have experienced this
kind of problem yourself.

I see that you are Microsoft MVP so do you think it's possible to send a
mail to microsoft telling them about my problem.

//Tony



"Kevin Spencer" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
> Hi Tony,
>
> The problem doesn't stem from the fact that the User Control assembly
> references the assembly it depends on, and that the executable

references
> the User Control assembly. I know that for a fact because I have done

this
> many times. What I don't know is what caused the error.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
>
> Show me your certification without works,
> and I'll show my certification
> *by* my works.
>
> "Tony Johansson" <(E-Mail Removed)> wrote in message
> news:93UXf.50730$(E-Mail Removed)...
>> Hello!
>>
>> I have one solution file that consist of three project.
>> One project that build the exe file called A
>> One project that build a user control dll. Here we have a class called

B
>> One project that build a class library dll. Here we have a class called

C
>>
>> We have one dependency and that is from the user control to the class
>> library because
>> in the constructor for class B in the user control we have a call to
>> instansiate class C in the class library dll.
>> public B()
>> {
>> InitializeComponent();
>> Last.C last = new Last.C();
>> last.foo();
>> }
>>
>> In the project that create the exe file I have a project reference to

the
>> user control.
>> In the project that create the user control I have a project reference

to
>> the class library.
>>
>> When I add the user control to the Toolbox I use the obj/debug

directory
>> to select the user control dll.
>>
>> Now to my problem when I try to drag the user control from the toolbox
>> into a form I get the following error "An exception occured while

trying
>> to create an instance of WindowsControlLibrary.B. The execption was

"?"."
>>
>> Is this kind of a bug that cause this problem.
>> Is it possible to solve this kind of problem in some way.
>> I have even rebuild the user control dll and the class library dll but

it
>> doesn't matter.
>>
>>
>> //Tony
>>
>>
>> I just wonder what is the requirement about the dll and its version on

the
>> dll
>>
>> I noticed that when I get error
>>
>>
>>
>>
>>
>>
>>
>>

>
>







 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      2nd Apr 2006
You misunderstood me, Tony. I have never had this problem. I have
successfully done the same thing you're trying to do without any problems,
and no, I didn't use the GAC.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"Tony Johansson" <(E-Mail Removed)> wrote in message
news:PmWXf.50783$(E-Mail Removed)...
> Hi!
>
> When I have this kind of problem what is the solution?
> If I put the class library in the GAC that is called by the user control
> would that solve my problem?
>
> Do you think that this could be a bug because you have experienced this
> kind of problem yourself.
>
> I see that you are Microsoft MVP so do you think it's possible to send a
> mail to microsoft telling them about my problem.
>
> //Tony
>
>
>
> "Kevin Spencer" <(E-Mail Removed)> skrev i meddelandet
> news:(E-Mail Removed)...
> > Hi Tony,
> >
> > The problem doesn't stem from the fact that the User Control assembly
> > references the assembly it depends on, and that the executable

> references
> > the User Control assembly. I know that for a fact because I have done

> this
> > many times. What I don't know is what caused the error.
> >
> > --
> > HTH,
> >
> > Kevin Spencer
> > Microsoft MVP
> > Professional Numbskull
> >
> > Show me your certification without works,
> > and I'll show my certification
> > *by* my works.
> >
> > "Tony Johansson" <(E-Mail Removed)> wrote in message
> > news:93UXf.50730$(E-Mail Removed)...
> >> Hello!
> >>
> >> I have one solution file that consist of three project.
> >> One project that build the exe file called A
> >> One project that build a user control dll. Here we have a class called

> B
> >> One project that build a class library dll. Here we have a class

> called C
> >>
> >> We have one dependency and that is from the user control to the class
> >> library because
> >> in the constructor for class B in the user control we have a call to
> >> instansiate class C in the class library dll.
> >> public B()
> >> {
> >> InitializeComponent();
> >> Last.C last = new Last.C();
> >> last.foo();
> >> }
> >>
> >> In the project that create the exe file I have a project reference to

> the
> >> user control.
> >> In the project that create the user control I have a project reference

> to
> >> the class library.
> >>
> >> When I add the user control to the Toolbox I use the obj/debug

> directory
> >> to select the user control dll.
> >>
> >> Now to my problem when I try to drag the user control from the toolbox
> >> into a form I get the following error "An exception occured while

> trying
> >> to create an instance of WindowsControlLibrary.B. The execption was

> "?"."
> >>
> >> Is this kind of a bug that cause this problem.
> >> Is it possible to solve this kind of problem in some way.
> >> I have even rebuild the user control dll and the class library dll but

> it
> >> doesn't matter.
> >>
> >>
> >> //Tony
> >>
> >>
> >> I just wonder what is the requirement about the dll and its version on

> the
> >> dll
> >>
> >> I noticed that when I get error
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>

> >
> >

>
>
>
>
>



 
Reply With Quote
 
tony
Guest
Posts: n/a
 
      3rd Apr 2006
Hello!

When I'm in design mode and drag the user control from the toolbox into
a form that exist in the project that build the exe file which search path
is used to locate the class library dll.

Many thanks

//Tony


"Kevin Spencer" <(E-Mail Removed)> skrev i meddelandet
news:e#(E-Mail Removed)...
> You misunderstood me, Tony. I have never had this problem. I have
> successfully done the same thing you're trying to do without any problems,
> and no, I didn't use the GAC.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
>
> Show me your certification without works,
> and I'll show my certification
> *by* my works.
>
> "Tony Johansson" <(E-Mail Removed)> wrote in message
> news:PmWXf.50783$(E-Mail Removed)...
> > Hi!
> >
> > When I have this kind of problem what is the solution?
> > If I put the class library in the GAC that is called by the user

control
> > would that solve my problem?
> >
> > Do you think that this could be a bug because you have experienced this
> > kind of problem yourself.
> >
> > I see that you are Microsoft MVP so do you think it's possible to send

a
> > mail to microsoft telling them about my problem.
> >
> > //Tony
> >
> >
> >
> > "Kevin Spencer" <(E-Mail Removed)> skrev i meddelandet
> > news:(E-Mail Removed)...
> > > Hi Tony,
> > >
> > > The problem doesn't stem from the fact that the User Control assembly
> > > references the assembly it depends on, and that the executable

> > references
> > > the User Control assembly. I know that for a fact because I have done

> > this
> > > many times. What I don't know is what caused the error.
> > >
> > > --
> > > HTH,
> > >
> > > Kevin Spencer
> > > Microsoft MVP
> > > Professional Numbskull
> > >
> > > Show me your certification without works,
> > > and I'll show my certification
> > > *by* my works.
> > >
> > > "Tony Johansson" <(E-Mail Removed)> wrote in message
> > > news:93UXf.50730$(E-Mail Removed)...
> > >> Hello!
> > >>
> > >> I have one solution file that consist of three project.
> > >> One project that build the exe file called A
> > >> One project that build a user control dll. Here we have a class

called
> > B
> > >> One project that build a class library dll. Here we have a class

> > called C
> > >>
> > >> We have one dependency and that is from the user control to the

class
> > >> library because
> > >> in the constructor for class B in the user control we have a call to
> > >> instansiate class C in the class library dll.
> > >> public B()
> > >> {
> > >> InitializeComponent();
> > >> Last.C last = new Last.C();
> > >> last.foo();
> > >> }
> > >>
> > >> In the project that create the exe file I have a project reference

to
> > the
> > >> user control.
> > >> In the project that create the user control I have a project

reference
> > to
> > >> the class library.
> > >>
> > >> When I add the user control to the Toolbox I use the obj/debug

> > directory
> > >> to select the user control dll.
> > >>
> > >> Now to my problem when I try to drag the user control from the

toolbox
> > >> into a form I get the following error "An exception occured while

> > trying
> > >> to create an instance of WindowsControlLibrary.B. The execption was

> > "?"."
> > >>
> > >> Is this kind of a bug that cause this problem.
> > >> Is it possible to solve this kind of problem in some way.
> > >> I have even rebuild the user control dll and the class library dll

but
> > it
> > >> doesn't matter.
> > >>
> > >>
> > >> //Tony
> > >>
> > >>
> > >> I just wonder what is the requirement about the dll and its version

on
> > the
> > >> dll
> > >>
> > >> I noticed that when I get error
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> > >

> >
> >
> >
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is it not possible to call a class library method from a user control. Tony Johansson Microsoft C# .NET 5 3rd Apr 2006 03:52 AM
This must be a bug in C# when using user control DLL and class library DLL Tony Johansson Microsoft Dot NET Framework 1 2nd Apr 2006 09:19 PM
This must be a bug in C# when using user control DLL and class library DLL Tony Johansson Microsoft Dot NET 0 2nd Apr 2006 05:10 PM
Custom Control - how to call another class's validation method Neville Lang Microsoft Dot NET Compact Framework 2 18th Aug 2005 02:34 PM
Using User Control from class library Marcel Gelijk Microsoft ASP .NET 5 25th Jan 2004 07:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:10 AM.