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
Results 1 to 4 of 4

Problem with ObjectsFromPoint

This is a discussion on Problem with ObjectsFromPoint within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I'm having trouble with the ObjectsFromPoint method. The following code throws an exception whenever there is a TextBox "under" ...

  1. #1
    pobe is offline Junior Member White Belt
    Join Date
    Oct 2005
    Posts
    5

    Problem with ObjectsFromPoint

    Hi,
    I'm having trouble with the ObjectsFromPoint method. The following code throws an exception whenever there is a TextBox "under" the x, y.

    MapPoint.FindResult fr = axMappointCtrl.ActiveMap.ObjectsFromPoint(x,y)
    foreach(object o in fr)
    {
    Debug.Writeline("Doing nothing...");
    }

    The method is fine as long as there is no textBox returned to the fr collection.

    When it is, the following exeption stack can be traced:

    at System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32 errorCode, IntPtr errorInfo)
    at System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32 errorCode)
    at System.Runtime.InteropServices.CustomMarshalers.En umeratorViewOfEnumVariant.GetNextElems()
    at System.Runtime.InteropServices.CustomMarshalers.En umeratorViewOfEnumVariant.MoveNext()


    Please, can anyone help me with this?

    //pobe

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

  3. #3
    pobe is offline Junior Member White Belt
    Join Date
    Oct 2005
    Posts
    5
    Hi,

    I read this on a Microsoft page, guess this is what happens in my code.


    The Map.ObjectsFromPoint method sometimes creates an invalid FindResults object. The count of the results is larger than the actual number of found items
    To answer your question: The exception is thrown in the foreach loop and since I don't do anythin in it it is the iteration itself that fails.

    /pobe

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

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. I loose a lot of street names with ObjectsFromPoint(X,Y)
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-17-2004, 11:06 AM
  2. ObjectsFromPoint: no other solutions ?
    By Alexoff in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 02-05-2003, 05:54 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