PDA

View Full Version : COM Exception



Roger Allen
11-08-2011, 11:30 AM
The program I am developing ran ok on a Windows 7 32 bit machine.

I installed the program on a new 64 bit windows 7 machine and the same code is giving an error:

Code:

oDataSet = oMapPoint.ActiveMap.DataSets.ImportData(sSpreadshe etName, arrayFieldTypes, , , MapPoint.GeoImportFlags.geoImportExcelSheet)

Error:

System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2147467259
Message=Error HRESULT E_FAIL has been returned from a call to a COM component.

I am completely at a loss to even know where to start looking for a solution, and advice would be greatly appreciated.

Roger

Mattys Consulting
11-08-2011, 03:58 PM
Hi Roger,

So this isn't the same problem you experienced in this thread:
http://www.mapforums.com/shapequery-error-16470.html

Perhaps the project properties require you to have COM-Visible?

Roger Allen
11-08-2011, 05:18 PM
Hi Roger,

So this isn't the same problem you experienced in this thread:
http://www.mapforums.com/shapequery-error-16470.html


No, I had the program working and just changed laptops. The same program works fine under MS Virtual PC XP Mode, on the new machine




Perhaps the project properties require you to have COM-Visible?

This is new to me, I thought assemblies were com visible by default.

Winwaed
11-09-2011, 07:05 AM
This is VB.Net? Be sure to set the compiler to produce 32 bit only code.

MapPoint only runs in 32 bit compatibility mode - so your extensions and calling apps have to do the same.

Richard

Roger Allen
11-09-2011, 12:52 PM
I exported data to csv files and then imported from those files instead of Excel - error went away.

BUT - NEW PROBLEM



lblCurrentProcess.Text = "Saving Map"
oMap.SaveAs(strFilePath & "\_Bonus_Map")
.
.
.
oMap.DataSets.ZoomTo()
.
.
.
oMapPoint.Visible = True
oMapPoint.UserControl = True
.
.
.
.lblCurrentProcess.Text = "Rec Route Analysis"
frmRouteAnalysis.ShowDialog()
.
.
.
oMapPoint.Visible = True
oMapPoint.UserControl = True
lblCurrentProcess.Text = "Loading Route"
subLoadRecommendedRoute()
lblCurrentProcess.Text = "Getting Route Options"
'Route_StartFinish()
SetRouteOptions()
lblCurrentProcess.Text = "Saving Map"
oMap.SaveAs(strFilePath & "\_Route_Map")



The first file save works - the second file save give a ComException
The only difference between the two (that I can see, is that the second save includes a route)

If I comment out the second save and try to save manually, I get the following error:

"This application is unable to continue running. The problem may be the result of low system resources such as memory or disk space......"

The application continues to run without a problem if I don't try to save the file.

I tried deleting the route and saving - no difference, still crashes.

Roger Allen
11-09-2011, 10:48 PM
SOLVED

I forced garbage disposal at several points in the code - problem went away.