example to write a COM component in C#?

  • Thread starter Thread starter kathy
  • Start date Start date
K

kathy

Could anyone know where I can find example to write a COM
component / ActiveX control in C# which can be used by
VB6/VC6?
 
And the super-short version of the key elements... in the project
properties, you enable COM Interop.. then you us the ComVisible attribute
above everything you want to be..... you guessed it, visibel from COM:

[ComVisible(true)]
class MyClass
{
[ComVisible(true)]
public void SomeFunc()
{
}
}

And there is some attribute at the Class level - where you specify what the
ProgID should be.. aside from that, this is the short course...
 
Hi,

You still have to run Regasm.exe /tlb... for the typelib to be generated and
registered.

Having ComVisible(true) for everything is the same as having no attribute at
all.

<quote source="msdn">
This attribute is not needed to make public managed assemblies and types
visible; they are visible to COM by default.
</quote>

Regards

Chris Taylor

Drebin said:
And the super-short version of the key elements... in the project
properties, you enable COM Interop.. then you us the ComVisible attribute
above everything you want to be..... you guessed it, visibel from COM:

[ComVisible(true)]
class MyClass
{
[ComVisible(true)]
public void SomeFunc()
{
}
}

And there is some attribute at the Class level - where you specify what the
ProgID should be.. aside from that, this is the short course...


Chris Taylor said:
Hi,

The following link should be a good starting point,
http://msdn.microsoft.com/library/d.../cpconexposingnetframeworkcomponentstocom.asp
Watch for line wrap!

Hope this helps

Chris Taylor
 
Back
Top