Solved

MapPoint in VB.Net - add pushpin to map

Posted on 2010-11-11
4
1,361 Views
Last Modified: 2012-05-10
I really hate MapPoint!  :)  I have an address in a variable named 'address' which looks like this (Street, City, State, Zip).  I'm trying to add a Push Pin to the map, with this address, but to no avail.  I always have problems programming MapPoint.  

Here's the code I have.  I get no errors.  However, no push pins appear on the map.  TIA.
AxMappointControl1.NewMap(MapPoint.GeoMapRegion.geoMapNorthAmerica) ' start new map

' ***
' address (variable) is defined here...figured you didn't need to see the code for that, and placed into a variable named 'address'
' ***

           ' plot this address onto the map
            Dim oPushPin As MapPoint.Pushpin
            Dim oMap As MapPoint.Map
            oMap = GetObject(, "MapPoint.Application").ActiveMap
            oPushPin = oMap.AddPushpin(oMap.FindResults(address)(1), "some text here") ' set pushpin to the current customer street address
            oPushPin.Location.GoTo() ' zoom in on last pushpin drawn

Open in new window

0
Comment
Question by:LD147
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 18

Accepted Solution

by:
lludden earned 500 total points
ID: 34113371
Your code works fine for me.  What version of Mappoint and VS are you using?  I tested with Vs2010 and MP2010.


        Dim oPushPin As MapPoint.Pushpin
        Dim oMap As MapPoint.Map
        oMap = GetObject(, "MapPoint.Application").ActiveMap
        oPushPin = oMap.AddPushpin(oMap.FindResults("1600 Pennsylvania Ave, washington dc")(1), "test") ' set pushpin to the current customer street address
        oPushPin.BalloonState = GeoBalloonState.geoDisplayBalloon
        oPushPin.Location.GoTo()


0
 
LVL 1

Author Comment

by:LD147
ID: 34114063
I am using VS2010 Ultimate and MP2010 America.  I tried your code....same thing.  No pushpin.  Weird....
0
 
LVL 1

Author Comment

by:LD147
ID: 34114773
I uninstalled MapPoint and reinstalled - the pushpins now appear on the map.  LOL.
0
 
LVL 1

Author Comment

by:LD147
ID: 34114787
Even though your code didn't really fix my problem, I appreciate the help :)  It turns out, I guess, that a setting, or something got corrupted somewhere.  The reinstall fixed it :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question