Solved

MapPoint in VB.Net - add pushpin to map

Posted on 2010-11-11
4
1,328 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now