PC Review


Reply
Thread Tools Rate Thread

COMException(0x800A000D): Type mismatch

 
 
MovnOn
Guest
Posts: n/a
 
      6th Oct 2003
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.
 
Reply With Quote
 
 
 
 
Kirk
Guest
Posts: n/a
 
      7th Oct 2003
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.



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Type mismatch: array or user-defined type expected Naftas Microsoft Excel Programming 3 23rd Mar 2010 03:43 PM
exception of type 'System.Runtime.InteropServices.COMException' Vmrincon Microsoft VB .NET 0 24th Oct 2006 08:42 AM
Type Mismatch: array or user defined type expected =?Utf-8?B?RXhjZWxNb25rZXk=?= Microsoft Excel Programming 4 6th Jul 2006 03:40 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Microsoft Excel Programming 1 31st Oct 2005 08:20 PM
Type mismatch error (different than previous type mismatch?) Roberta Microsoft Access VBA Modules 3 9th Jan 2004 06:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:39 PM.