I'm trying to create a simple vb.net (server) dll, and then through
late binding access the public methods of the contained class from
another vb.net (client) app. I can do it through early binding. When i
try late binding it allows me to load the assembly, I can even see the
methods contained within through reflections, but it fails at the
point were I try to access the method opencomms or any other method of
this server class. The error message I get is:
An unhandled exception of type 'System.NullReferenceException'
occurred in microsoft.visualbasic.dll
Additional information: Object variable or With block variable not
set.
this is the code in the client app
windows app calling this routine
option strinct off
Public Sub StartContainer()
Dim SampleAssembly As [Assembly]
Dim obj As Object
SampleAssembly = [Assembly].LoadFrom("C:\Protocol\obj\Debug
\Protocol.dll")
obj =
SampleAssembly.CreateInstance("ProtocolFile.Protoc olDll")
obj.opencomms()
End Sub
ProtocolFile.vb complied as Protocol.dll
Public Class ProtocolDll
Public Sub OpenComms()
Console.Write("hello")
End Sub
End Class
Any ideas where I'm going wrong, I can't seem to find any useful
examples that will give me this anywhere.
thanks in advance
Rob