dgb
asked on
Creating my own object using System.Activator.CreateInstance
I am trying create an instance of an object using late binding.
Here is what i did.
make Interface dll
make dll wich implements the interface dll
make standard app wich creates an instance of the dll using late binding.
(System.Activator.CreateIn stance)
But it didn't work, i am getting the errormessage
Can't load assembly TestSubService
Here is what i did.
make Interface dll
make dll wich implements the interface dll
make standard app wich creates an instance of the dll using late binding.
(System.Activator.CreateIn
But it didn't work, i am getting the errormessage
Can't load assembly TestSubService
Dim newTestSubService As Selfmade_Interfaces._ISubService
newTestSubService = System.Activator.CreateInstance("TestSubService", "SubService")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ok, now it sounds like you are using .NET remoting, so can you tell me what the class looks like, as far as interface implementation, and inheritance?
ASKER
I had to use ObjectHandle.UnWrap now i have an object that i can access.
In short
Dim newObjectHandle as objecthandle
newTestSubService As Selfmade_Interfaces._ISubS ervice
newObjectHandle = System.Activator.CreateIns tance("Tes tSubServic e", "SubService")
newTestSubService = newObjectHandle.UnWrap
This works
In short
Dim newObjectHandle as objecthandle
newTestSubService As Selfmade_Interfaces._ISubS
newObjectHandle = System.Activator.CreateIns
newTestSubService = newObjectHandle.UnWrap
This works
ASKER
Typo
newObjectHandle = System.Activator.CreateIns tance("Tes tSubServic e", "SubService")
should have been
newObjectHandle = System.Activator.CreateIns tance("Tes tSubServic e", "TestSubService.SubService ")
Thanks
newObjectHandle = System.Activator.CreateIns
should have been
newObjectHandle = System.Activator.CreateIns
Thanks
ASKER
System.Runtime.Remoting.Ob
I am using CType for the converting bit