Does Activator.CreateInstance work on Friend contructors?

  • Thread starter Thread starter kw_harry
  • Start date Start date
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.
 
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
 
Back
Top