passing Collections with VB6 COM objects

G

Guest

I am trying to use a COM object which has a parameter of type Collection in
VB6. .Net recognizes this collection as a VBA.Collection object. When I try
creating a VBA.Collection in .Net using:

Dim objColl As New VBA.CollectionClass()

I get the following error:
An unhandled exception of
type 'System.Runtime.InteropServices.COMException'
occurred in WindowsApplication4.exe

Additional information: COM object with CLSID {A4C4671C-
499F-101B-BB78-00AA00383CBB} is either not valid or not
registered.

If I try passing a .Net Collection for example:
Dim objColl As New Collection()
Dim objZip As New CILZip.CIZipClass()
objColl.Add("C:\test.xml")
objZip.Archive(objColl, "c:\Test.zip")

I get the following error when I call the COM object:
An unhandled exception of
type 'System.InvalidCastException' occurred in
WindowsApplication4.exe

Additional information: Specified cast is not valid.

Am I overlooking something or is a collection a
unsupported type of interop?
 

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