I could be wrong, but my guess is that you are using a .Net collection class
and trying to pass it as the argument to the COM object. Obviously the COM
object cannot use that collection object (type mismatch because it is
looking for some other collection object) since it has no ability to use
..Net Collections. The fix would be to declare your col variable as the
specific Collection type that is used in the COM object.
Kirk Graves
"MovnOn" <(E-Mail Removed)> wrote in message
news:079801c38c57$8b4bcd30$(E-Mail Removed)...
> I'm writing a program that uses a COM object. If I were
> writing this code in VB6, the signature of the method of
> the COM object I need to use would be: saveMemo
> (Collection) The method takes a collection as the
> parameter.
>
> I did a tblimp (I get the same results if I add the COM
> object as a reference) on the COM object and when I use
> this in .NET, the same method has a signature of: saveMemo
> (Object) and the Object is passed ByRef.
>
> I tried this code:
>
> dim col as collection
> col.Add("Memo text")
> dim obj as object = CType(col, Object)
> saveMemo(obj)
>
> This produced the error:
> COMException(0x800A000D): Type mismatch
>
> Microsoft knowledge base article 317887 references this
> error as a bug (.NET method that takes a ByRef value type
> parameter fails when you pass a variant type), but I'm not
> sure how this relates to my problem. I'm not passing any
> variant types. This is the only documentation I could find
> on this error.
>
> Can someone help me figure out what to pass to this method
> that will work?
>
> Thanks.
|