Doubt

  • Thread starter Thread starter Baskar RajaSekharan
  • Start date Start date
B

Baskar RajaSekharan

Hi,

Please clarify my doubt in C#.
I have one Dll which is created in (VC7). I want to load the Dll
dynamically in my C# project. How to do that. How to load the Dll
Dynamically.

In Vb, We get the ProgId and then with the help of CreateObject we
do it. Similary Is there any way to do it in C#. If so please let me know.
Give some example or Some MSDN Link.

Regards,
R.Baskar
 
Baskar,
In Vb, We get the ProgId and then with the help of CreateObject we
do it. Similary Is there any way to do it in C#.

Yes, you can use Type.GetTypeFromProgID and pass the returned Type
object to Activator.CreateInstance.



Mattias
 
Thank you for your reply. But It's not Working fine. Plese let me know
what kind of mistake i done. I am herewith sending my code.

object hdlSample;

Type myType1 = Type.GetTypeFromProgID("WizardTestRBK.CallbackImpl.1");

hdlSample = Activator.CreateInstance(myType1);

The WizardTestRBK.CallbackImpl.1 component contains one Method called
Execute. When i try to access the method by using

hdlSample . The Exectue method is not come in intellicence. Please let
me know how to access the Mthod



Regards,

R.Baskar
 
Baskar,
The Exectue method is not come in intellicence. Please let
me know how to access the Mthod

If you have a typelib describing the COM interface and its method you
can reference that, cast the object to the right interface and call
the method in an early bound fashion.

If not, you use myType1.InvokeMember("Execute", ..., hdlSample, ...)
to do a late bound call.



Mattias
 
Back
Top