Calling remote VB6 Com components in c#

  • Thread starter Thread starter Curt
  • Start date Start date
C

Curt

Hi,

I have, in vain, tried to create a com object from a remote server.
Setup;

This is the code that fails.

Projekt.ClassName
_BOMsg = (SBO_BO_1_1.BO_MessageClass)Activator.CreateComInstanceFrom
("E:\\SharpDevelop
Projects\\Woff\\bin\\Debug\\Interop.Projekt.dll","Projekt.ClassName").Unwrap();

It compiles but then fails misserably when I try to run it, and this
is the error:

Woff.RsMarshallTest.CreateSBOMsg failed:

System.MissingMethodException : Constructor on type Projekt.ClassName
not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags
bindingAttr, Binder binder, Object[] args, CultureInfo culture,
Object[] activationAttributes)
at System.Activator.CreateComInstanceFrom(String assemblyName,
String typeName, Byte[] hashValue, AssemblyHashAlgorithm
hashAlgorithm)
at System.Activator.CreateComInstanceFrom(String assemblyName,
String typeName)
at Handelsbanken.SPP.Woff.RsMarshall.TestSBOMsg() in
e:\SharpDevelop Projects\Woff\RsMarshall.cs:line 43
at Woff.RsMarshallTest.CreateSBOMsg() in e:\SharpDevelop
Projects\Woff\RsMarshallTest.cs:line 29


I have no constructor since it is a vb6 som component so what else?

Any help is appreciated.

Thanxs Greger
 
Curt,

It looks like you are trying to call CreateComInstanceFrom on the
interop wrapper that is already created. You don't need to do this. If you
have an interop wrapper already created, you can just load that assembly,
and dynamically create the class from that (through a call to
CreateInstance).

Hope this helps.
 
Back
Top