Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

unexpected error

This is a discussion on unexpected error within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi all, using vb.net 2005 and mp2006, the code below seems to work fine until I try and add a ...

  1. #1
    kevsbox is offline Junior Member White Belt
    Join Date
    Feb 2007
    Posts
    6

    Smile unexpected error

    Hi all, using vb.net 2005 and mp2006, the code below seems to work fine until I try and add a dataset, then I get 'unexpected error'. Any ideas please.

    Code:
      Public PPVehicles As MapPoint.DataSet
      map.objMap = mp1.ActiveMap
      'Remove any existing objects (so that we may rebuild them)
      Try
        map.objMap.DataSets("Addbook").Delete()
        map.objMap.DataSets("StaticObj").Delete()
        map.objMap.DataSets("Vehicles").Delete()
      Catch
      End Try
      Try
        'error on line below
        If Not PPVehicles Is Nothing Then PPVehicles.Delete() 
      Catch ex As Exception
      End Try

    captured error is
    System.Runtime.InteropServices.COMException {"An unexpected internal error occurred."} System.Runtime.InteropServices.COMException


    Thanks in advance
    Last edited by Wilfried; 02-13-2007 at 04:01 AM. Reason: code blocks

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: unexpected error

    Hi,

    You declare PPVehicles as a mappoint dataset, but it is not assigned to something on the map.

  3. #3
    kevsbox is offline Junior Member White Belt
    Join Date
    Feb 2007
    Posts
    6

    Re: unexpected error

    Hi Wilfried
    Thanks for the reply
    I am new to mappoint, what I want to do is place an array of vehicles of the map using their last known lat/lon.
    Can you point me towards a good example of how to do this or even post one up.

    Thanks

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: unexpected error

    Hi,

    AddPushpin will add pushpins to a dataset named "My Pushpins". This dataset is automatically created. For each position you add a pushpin and give it an exclusive name. If the vehicle move then you dont create a new pushpin but you just give it other location. You can find it by using FindPushpin(name); Dit shows you how to add one and how you can play around with the balloon etc:

    Code:
    Location loc = MP.ActiveMap.GetLocation(lat, lon, 1);
    Pushpin pp  = MP.ActiveMap.AddPushpin(loc, name);
    pp.Symbol = 1;
    pp.Note = "Hello";
    pp.BalloonState = GeoBalloonState.geoDisplayBalloon;
    pp.Highlight = true;

  5. #5
    kevsbox is offline Junior Member White Belt
    Join Date
    Feb 2007
    Posts
    6

    Re: unexpected error

    Hi
    I have adapted my code as suggested but still get an error, any ideas please

    code is

    'global var
    Public objMap As MapPoint.Map

    'defined prior to the function thus, this provides no errors
    map.objMap = mp1.ActiveMap
    'mp1 is a map control on the main form

    PublicSub RefreshMapfromVehList()
    Dim loc As MapPoint.Location
    Dim pp As MapPoint.Pushpin
    Dim f AsInteger = 0
    Try
    For f = 0 To VehicleCount
    If Vehicle(f).ShowOnMap Then'Update available
    'next line works fine and returns as expected
    loc = objMap.GetLocation(Vehicle(f).lat, Vehicle(f).lon, 1)
    'next line generates the error as shown below
    pp = objMap.AddPushpin(loc, Vehicle(f).Vehicle)
    'ErrorCode -2146824288 Integer
    'Message "An unexpected internal error occurred."
    pp.Symbol = 1
    pp.Note = Vehicle(f).Vehicle
    pp.BalloonState = MapPoint.GeoBalloonState.geoDisplayBalloon
    pp.Highlight =
    True
    If Vehicle(f).Dir <= 180 Then
    pp.Symbol = VehicleIcons(Vehicle(f).Category, Vehicle(f).Status, 0).ID
    Else
    pp.Symbol = VehicleIcons(Vehicle(f).Category, Vehicle(f).Status, 1).ID
    EndIf
    EndIf
    Next
    Catch ex As Exception
    gc.ErrorBox(ex.Message)
    EndTry

    EndSub

    what I have noticed is that when i look at the properties of objMap the value for datasets.data.message is "An unexpected internal error occurred.". In view of this I reinstalled mappoint but still got the same.

    Help please

    ------------------
    Life is but a dream.

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: unexpected error

    Hi,

    For f = 0 To VehicleCount

    Should this not be 0 to VehicleCount - 1 ? or if you have index based from 1 (I think this is possible in VB): 1 to VehicleCount ? Because like it is now the counter will do 1 more than VehicleCount.

    On the other hand the GetLocation works. So this is very strange. is it in the first pass you have the error ? (when f == 0). Can you check Vehicle(0).Vehicle if it is a valid string ?

  7. #7
    kevsbox is offline Junior Member White Belt
    Join Date
    Feb 2007
    Posts
    6

    Re: unexpected error

    Hi Wilfried

    Yep the array has valid data.

    Regards
    ------------------
    Life is but a dream.

  8. #8
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: unexpected error

    Hi,

    and is it in the first pass (when the index is zero) ? And is the index zero based ?

  9. #9
    kevsbox is offline Junior Member White Belt
    Join Date
    Feb 2007
    Posts
    6

    Re: unexpected error

    yes and yes
    Another thing I have just noticed is when in mappoint - data mapping wizard, anything I try to do result in the following error 'Demographic data is missing or corrupted. Reinstall Mappoint'
    Is this related? I have tried a new full install and still get same error?
    ------------------
    Life is but a dream.

  10. #10
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: unexpected error

    Hi,

    I'm running out of ideas

    What happens if you try just this very basic thing:

    loc = objMap.GetLocation(51, 4, 1)
    pp = objMap.AddPushpin(loc, "Wilfried")

    or with any other lat / long ? Do you get the same error ?

    I have no idea wy you get this error with the data mapping wizart. As I say I' really running out of idea

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Running VB6 on windows XP - unexpected error; quitting
    By testuser14 in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-15-2005, 12:20 PM
  2. An unexpected error occurred on a receive
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 01-27-2005, 03:11 AM
  3. About ERROR 4-40028-1. Error or Bug ?
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 12
    Last Post: 01-11-2005, 10:32 AM
  4. I get this following error
    By ananthdeena in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 01-01-2005, 03:46 AM
  5. unexpected error;quitting
    By Syd in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 04-07-2004, 07:17 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66