Quote:
1.> Why no intellisense For my X Object? |
That has to do with the defaults when using .NET Interop
Quote:
2.> I have seen code with the following dotnet attributes... How would I
benefit from these?
a.> ClassInterface(ClassInterfaceType.AutoDual)
b.> ProgId("Some.NameSpace.And.ClassName")
c.> Guid("SOME GUID") |
This is what I recoomend:
1. At the Assembly level, make ComVisible False. This allows you to
only expose those classes and interfaces that you want.
2. Use ComVisible True on your Interfaces so they will be exposed to
VB. Also use InterfaceType of InterfaceIsDual. This will allow the
interface to be used via both early and late binging. (You don't have
Intellisense now because you are only supporting late-binding).
3. In the classes that implement these interfaces, again use
ComVisible True but the ClassInterface should be None. This is
because you are explicitly implementing an interface you have exposed
to COM, and you don't want the compiler/typeexporter to try to do it
for you.
At the bare minimum, that should give a great start to doing COM
interop so it works well with VB6.
I usually create GUIDs explicitly, but if you don't then one will be
generated for you. The ProgId lets you create VB6-friendly names
because otherwise you might have conflicts with longer Assembly names,
and I usually take advantage of this feature as well.
Finally, I use the DispIdAttribute on each of my Interfaces methods.
Again they would be generated for you if you don't do it, but I like
everything to be explicit.
Good luck!
Tom