Below is a code snippet that takes lat/lon data from a database and plots it on MapPoint 2004. This sub randomly returns the error message "HRESULT 0x80040E04". I have pulled all I can from the exception object:
Method: Paste
StackTrace: at MapPoint.DataSet.Paste()
Message: Exception from HRESULT: 0x80040E04
Has anyone seen this before? Any suggestions?
Thanks,
Thomas
Dim oMap As MapPoint.Map
Dim oLoc As MapPoint.Location
Dim oPushpin As MapPoint.Pushpin
Dim oDS As MapPoint.DataSet
Dim oRoute As MapPoint.Route
'Query Database
sdst = SqlHelper.ExecuteDataset(UserSettings.ConnString, "getMobileHistory", SqlHelper.ExecuteScalar(UserSettings.ConnString, "getMobileIDFromName", Mobile), CDate(dt1.Text & " " & dt2.Text), CDate(dt3.Text & " " & dt4.Text), eList)
'Initialize MapPoint objects
oMap = Map.MapCtl.ActiveMap
oMap.Saved = True
oRoute = oMap.ActiveRoute
'Set Up Map for pushpin dataset
oMap.DataSets.AddPushpinSet(Mobile)
oDS = oMap.DataSets(Mobile)
oDS.Symbol = 256
oDS.Select()
'cycle through DataSet
For jj = 0 To sdst.Tables(0).Rows.Count - 1
latitude = sdst.Tables(0).Rows(jj).Item(2)
longitude = sdst.Tables(0).Rows(jj).Item(3)
oLoc = oMap.GetLocation(latitude, longitude, 1)
oRoute.Waypoints.Add(oLoc, CStr(i + 1))
oPushpin = oMap.AddPushpin(oLoc)
oPushpin.Note = "Vehicle: " & Mobile & vbNewLine & _
"Time: " & LogTime & vbNewLine & _
"Event: " & EventName & vbNewLine & _
"Heading: " & Heading & vbNewLine & _
"Speed: " & Speed & vbNewLine
oPushpin.Name = i
oPushpin.Symbol = symbol
oPushpin.Cut()
oDS.Paste()
i = i + 1
Next