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

Identifying Selection with Mouse

This is a discussion on Identifying Selection with Mouse within the MapPoint Desktop Discussion forums, part of the Map Forums category; working in VB with a Mappoint object. I'm trying to select a starting point on a map (a lat/long position) ...

  1. #1
    MapPointJim is offline Junior Member White Belt
    Join Date
    Aug 2002
    Posts
    2

    Identifying Selection with Mouse

    working in VB with a Mappoint object.

    I'm trying to select a starting point on a map (a lat/long position) using my mouse pointer. It looks like I can either
    click a location on a map (like a city) or draw a rectangle. Either way I need to identify the lat/long of either the selected city or upper left corner of my drawn retangle.

    I have some code I downloaded off this site to identify the lat log if given zipcode for the input. My question is this: Can I return a zipcode from either of the above two selection methods? Or is there a better way to do this.

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    This code sample will: If you click your mouse on the map, if it is a location type it will give you a message box with the Lat/Lon.

    Here is an article you need to check out: A More Compact Method for Obtaining Lat/Long. Author: Gilles Kohl

    http://www.mp2kmag.com/articles.asp?ArticleID=13


    'Put Gilles code in a bas module for the CalcPos function call.

    'Put this in the general declatations section
    Public thelat As Double
    Public thelon As Double


    'I'm using a Mappoint ActiveX Control named MappointControl1 on my form for this example


    Private Sub MappointControl1_SelectionChange(ByVal pNewSelection As Object, ByVal pOldSelection As Object)
    On Error GoTo error:
    Dim objmap As MapPointCtl.Map
    Dim objLoc As MapPointCtl.Location
    Set objmap = MappointControl1.ActiveMap
    If TypeOf objmap.Selection Is Location Then
    Set objLoc = objmap.Selection

    CalcPos objmap, objLoc, thelat, thelon
    MsgBox thelat & " , " & thelon
    End If

    Exit Sub
    error:
    End Sub

  3. #3
    MapPointJim is offline Junior Member White Belt
    Join Date
    Aug 2002
    Posts
    2
    works great!

    though now I get a server busy box. It asks to "switch to" or "retry". To get out of it I must use task manager.

  4. #4
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    I think if you do something with the lat/lon other than bring it up in a message box you will not get that error. The message box is waiting for you to click "OK" keeping that SelectionChange event open gives that error.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Is this possible? Identifying points within radius of terr.
    By Kogenta in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-17-2006, 12:56 PM
  2. Pushpin Selection
    By EdB in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 08-14-2005, 09:25 AM
  3. Getting dataset from user selection
    By mic6399 in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-23-2004, 10:59 AM
  4. Zoom to selection?
    By sthurlock in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 12-10-2003, 06:53 PM
  5. Have successfully exported a map selection from Ma....
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-05-2001, 04:14 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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83