You need to specify the full assembly name:

Type type = Type.GetType("BusinessLayer.Report.Render.StudentHtmlWriter,
YourAssemblyName");

If your assembly is strong named, then you need to specify Version, Culture
and PublicKeyToken.

The reason this is happening is when no assembly name is specified on a
Type.GetType call, the runtime look in the calling assembly. If it can't be
find in the calling assembly it returns null.

Adam..

> -----Original Message-----
> From: Unmoderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of Mark Marlow
> Sent: Tuesday, May 17, 2005 3:47 PM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: [ADVANCED-DOTNET] Type.GetType returns null
>
> Hi All,
>
> I am trying to create an instance of a class using something
> like this from an assembly other than the one where the
> concrete class is defined.  What am I doing wrong?
>
> Much thanks!
> Mark
>
>
>
> object[] args = {parm};
>
> Type type =
> Type.GetType("BusinessLayer.Report.Render.StudentHtmlWriter");
> // <-BUG type is null after this call
>
> BaseHTMLWriter writer =
> (BaseHTMLWriter)Activator.CreateInstance(type,args);

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to