Does Activator.CreateInstance work on Friend contructors?

K

kw_harry

I have a class with a contructor that is declared
Protected Friend. In another class in the same assembly I
try to create a new instance of the class using
Activator.CreateInstance, but I get a missing procedure
exception. Is there a reason why this doesn't work? I
don't have a problem when I directly call the contructor,
but Activator.CreateInstance does not work. Any ideas?
Thanks.
 
E

Eric Newton

You're not having a problem calling the constructor because *YOU'RE* calling
it inside the same assembly. Try calling it from a different project and
you'll get a compiler error.

Secondly, Activator.CreateInstance has some overloads, one of which includes
specifying binding flags to use, IE Public vs Non public etc., so look into
that.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top