Re: VB.net dll late binding to a vb.net app




here is a working simple example

http://www.vbdotnetcoder.com/reflectionexample.rar


hth

michel Posseth



"Michel Posseth [MCP]" wrote:

well it should work like this ( at least it does with me :- )

< info you have read in the previous post >
The concept is pretty simple

1. create a generic interface and compile this to a dll
2. create your plugin and implement the interface in the class you want to
start from the outside

3. create a application and set a reference to the interface dll

now you do

Dim objAssembly As Reflection.Assembly
objAssembly = Reflection.Assembly.LoadFrom(FullPathToAssemblyDllOrExe)

Dim YourObject as Yourinterface =
DirectCast(objAssembly.CreateInstance(Namespace.YourClassToInvoke),
Yourinterface)

Note :
Namespace.YourClassToInvoke ( namespace defaults to the assembly name but
can be set under project , properties , application , root namespace )

And that`s it !! :-)

YourObject is now initiated and can be controled from your code with the
interface that you provided
</info you should have read in the previous post >

probably something goes wrong here

example from one of my test projects

Dim objAssembly As Reflection.Assembly
objAssembly =
Reflection.Assembly.LoadFrom("C:\ProgramFiles\ista\NeProS\QueueService\QueuClassTest.dll")

Dim YourObject as Yourinterface =
DirectCast(objAssembly.CreateInstance(ista.Test),
Yourinterface)

Note the ista. part is the namespace ( you must provide the namespace name )


I will wrap up a hello world example

regards

Michel





"b00n1" wrote:

Michel

I've taken a look at this and tried one of your examples creating a
generic interface compiled to a dll then referenced and implemented in
the late bound dll, then reference the generic interface in the client
app, do a directcast as you say and I still get the same result. what
going on...

Rob


.



Relevant Pages

  • Re: VB.net dll late binding to a vb.net app
    ... create a generic interface and compile this to a dll ... create a application and set a reference to the interface dll ... part is the namespace ...
    (microsoft.public.dotnet.languages.vb)
  • Re: VB.net dll late binding to a vb.net app
    ... the late bound dll, then reference the generic interface in the client ... do a directcast as you say and I still get the same result. ...
    (microsoft.public.dotnet.languages.vb)