By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,602 Members | 1,463 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,602 IT Pros & Developers. It's quick & easy.

COMException(0x800A000D): Type mismatch

P: n/a
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.
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <LR********@aol.com> wrote in message
news:07****************************@phx.gbl...
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.

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.