tdolphin
tdolphin

Reputation: 127

typeconverter from dll

I am using the propertygrid with a class and associated type converter. When I moved the class and the TypeConverter to a dll, it seems that it is not being called. Can't find how to activate the typeconverter from a dll.

Assembly a = Assembly.LoadFile(modulepath + elementname + ".dll");
try
{
    object myobj = a.CreateInstance(objectname);            
    Type objecttype = myobj.GetType();
}

Appreciate any hints. Thank you.

Upvotes: 3

Views: 307

Answers (2)

erikkallen
erikkallen

Reputation: 34421

It could be because Assembly.LoadFile loads the file in a different binding context from the rest of your code.

Upvotes: 2

Joshua Cauble
Joshua Cauble

Reputation: 1349

Do you have something like this in place on your class:

   [TypeConverter(typeof(MyClassConverter))]
 public class MyClass {
    // Insert code here.
 }

Usually as long as the class has the typeconverter associated with it it should pick it up.

Upvotes: 2

Related Questions