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 5 of 5

Finding Pushpin Name by clicking on the Pushpin?(MP 2002)

This is a discussion on Finding Pushpin Name by clicking on the Pushpin?(MP 2002) within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, I am a relatively beginner programmer and would certainly appreciate your help with my problem. I am adding with ...

  1. #1
    NickSP is offline Junior Member White Belt
    Join Date
    Jan 2003
    Posts
    10

    Finding Pushpin Name by clicking on the Pushpin?(MP 2002)

    Hi,
    I am a relatively beginner programmer and would certainly appreciate your help with my problem.
    I am adding with the help of a Recordset from an Access database to Mapoint and adding pushpins with names as IDs that I get from the Recordset from Access. So far so good.
    What I want to know is can I select the ID or the pushpin name of each individually clicked pushpin? I am doing this in VB6 Thanks.
    Nick.

  2. #2
    John Meyer's Avatar
    John Meyer is offline Senior Member Blue Belt
    Join Date
    Jul 2002
    Posts
    478
    Nick,

    You could put this in a command button.

    Code:
    Dim objmap As MapPointctl.Map 
    Dim objPushpin As MapPointCtl.Pushpin 
    
    Set objmap = MapPointControl1.ActiveMap 
          'Make sure the item selected on the map is a pushpin 
        If TypeOf objmap.Selection Is Pushpin Then 
          Set objPushpin = MapPointControl1.Selection        
          'Do Something 
          msgbox objpushpin.name
        End If

  3. #3
    NickSP is offline Junior Member White Belt
    Join Date
    Jan 2003
    Posts
    10

    It Worked!

    John, the piece of code worked great. Thanks again.

  4. #4
    stiemark is offline Junior Member White Belt
    Join Date
    Dec 2002
    Posts
    4
    If this is going to be used by other people, you also want to trap the case where there is no selection. If you don't do that, the program will error when you try to ask the typeof nothing.
    Try this:
    Code:
    Dim objmap As MapPointctl.Map 
    Dim objPushpin As MapPointCtl.Pushpin 
    
    Set objmap = MapPointControl1.ActiveMap 
    
    'Make sure the item selected on the map is a pushpin 
    If Not objmap.Selection is nothing Then
      If TypeOf objmap.Selection Is Pushpin Then 
        Set objPushpin = MapPointControl1.Selection        
        'Do Something 
        msgbox objpushpin.name 
      End If
    End If

  5. #5
    NickSP is offline Junior Member White Belt
    Join Date
    Jan 2003
    Posts
    10
    Thanks a lot Sitemark, I had already figured that out but not before encountering the error you talked about. (learning the hard way). But thank you very much for the code as any help is always appreciated.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Get PushPin
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-03-2005, 10:16 AM
  2. automate clicking action
    By zauber in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-10-2004, 04:23 AM
  3. Discuss news by clicking New Topic
    By Eric Frost in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 06-15-2003, 08:29 PM
  4. finding a pushpin from a .dll
    By blackmap in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-10-2003, 02:11 PM
  5. pushpin
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 08-30-2002, 08:41 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