How to write a COM components ...?

K

kathy

In VB.NET help file "Walkthrough: Creating COM Objects
with Visual Basic .NET", It said:

"Note The COM objects you generate with Visual
Studio .NET cannot be used by other Visual Studio .NET
applications. Attempts to add references to such COM
objects raise an error."

My question is:

How to write a COM objects which can also be used by
Visual Studio .NET application?
 
J

Jeremy Cowles

"Note The COM objects you generate with Visual
Studio .NET cannot be used by other Visual Studio .NET
applications. Attempts to add references to such COM
objects raise an error."

My question is:

How to write a COM objects which can also be used by
Visual Studio .NET application?

You notice that the Note above never says you cant reference the object
directly, you just can reference it as a COM object. So basically this mean
that when you create a .NET COM object, you get a .TLB file and a .DLL or
..EXE. The note above is just saying that you can't use the _COM_ object in
..NET, but the plain assembly (.DLL) should be fine.

This is the way I understood it, and I may be wrong, but does that make
sense?

~
Jeremy
 
A

Armin Zingler

kathy said:
In VB.NET help file "Walkthrough: Creating COM Objects
with Visual Basic .NET", It said:

"Note The COM objects you generate with Visual
Studio .NET cannot be used by other Visual Studio .NET
applications. Attempts to add references to such COM
objects raise an error."

My question is:

How to write a COM objects which can also be used by
Visual Studio .NET application?

"Note The COM objects you generate with Visual
Studio .NET cannot be used by other Visual Studio .NET
applications. Attempts to add references to such COM
objects raise an error."


Maybe you could write a wrapper component in VB6 for your .NET COM component
and use it in the other .NET project... not really a good suggestion, I
know. Hopefully a better one: Do you really need a .NET-COM component in
another .NET application? Why don't you use the managed .NET component
directly, not via it's COM wrapper?
 
H

Herfried K. Wagner [MVP]

Hello,

kathy said:
In VB.NET help file "Walkthrough: Creating COM Objects
with Visual Basic .NET", It said:

"Note The COM objects you generate with Visual
Studio .NET cannot be used by other Visual Studio .NET
applications. Attempts to add references to such COM
objects raise an error."

My question is:

How to write a COM objects which can also be used by
Visual Studio .NET application?

http://msdn.microsoft.com/library/en-us/vblr7/html/valrfCOMClassAttribute.asp

HTH,
Herfried K. Wagner
 
K

kathy

see my question and MSDN Note:
"Note The COM objects you generate with Visual
Studio .NET cannot be used by other Visual Studio .NET
applications. Attempts to add references to such COM
objects raise an error."
 
H

Herfried K. Wagner [MVP]

Hello,

kathy said:
see my question and MSDN Note:

My question: Why write a COM object in .NET for use with a .NET
application?!

Regards,
Herfried K. Wagner
 
P

Paul Clement

¤ In VB.NET help file "Walkthrough: Creating COM Objects
¤ with Visual Basic .NET", It said:
¤
¤ "Note The COM objects you generate with Visual
¤ Studio .NET cannot be used by other Visual Studio .NET
¤ applications. Attempts to add references to such COM
¤ objects raise an error."
¤
¤ My question is:
¤
¤ How to write a COM objects which can also be used by
¤ Visual Studio .NET application?

The purpose of this article is to demonstrate how to build a .NET class for COM interop with
applications which implement COM (such as Visual Basic 6.0).

You don't need to build a COM class for use by .NET nor would you want to if you can build and use
standard .NET class libraries.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
K

kathy

The scenario could happen because I give the COM
component written in .NET which my custom might use it in
VB6 or .NET. I do not want to maintain different code
base.
 
J

Jeremy Cowles

kathy said:
The scenario could happen because I give the COM
component written in .NET which my custom might use it in
VB6 or .NET. I do not want to maintain different code
base.

kathy, please read my reply to your orriginal post
 
H

Herfried K. Wagner [MVP]

Hello,

kathy said:
See my posting in this thread for your question.
;-)

then answer my question!


The answer is simple: Reference the component as .NET component, not as a
COM object. You _cannot_ reference the COM object, but you can reference
the .NET component in your .NET applications.

Regards,
Herfried K. Wagner
 

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