Calling remote VB6 Com components in c#

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top