473,387 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

COMException(0x800A000D): Type mismatch

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
1 4553
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Damaji Jambhale | last post by:
COMException: Catostrphic failure When I added a "dll" reference in the web project. I was able to instantiate the class OK. But when I tried to set the properties, it failed with...
1
by: webstuff | last post by:
Hi, I'm getting a 'Type mismatch' exception when calling the Word.Application.Documents.Open method when using the Office XP 2003 PIAs. the actual error is: ...
2
by: Bassel Tabbara | last post by:
I wrote the following code: oApp = new Outlook.Application(); oApp = new Outlook.Application(); oNameSpace= oApp.GetNamespace("MAPI"); oNameSpace.Logon(null,null,true,true); //gets defaultfolder...
1
by: amitbadgi | last post by:
I am getting the following error while converting an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Data type mismatch in criteria expression. ...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
1
by: marfi95 | last post by:
I'm trying to call a 3rd party ocx from my vb.net app. I've added the ocx by customizing the toolbox so the interop references get added automatically. However, when I make a call to the ocx, I...
3
by: Jay A. Moritz | last post by:
I have an application that loads IE and iterates through web pages to retrieve information from the page then activates specific controls to retrieve the next page and iterate through that page for...
2
by: ortega23 | last post by:
Hi, I am trying to obtain the column number of the parent of a cell, if the cell is a linked cell (i.e. its value depends on another cells value). I try to read "Precedents"(parent cells) of...
1
by: EdwardH | last post by:
Hello All, I 'm having problem with a comException - Type Mismatch error, I have checked the data types in my table which resides in an Ms Access database. A snippet of code is posted below, the line...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.