Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7787535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:42:12+00:00 2026-06-01T20:42:12+00:00

I am currently learning about these maps. Now I would like to create a

  • 0

I am currently learning about these maps. Now I would like to create a method which updates my push pin if I already have one.

a. I tried to use setLocation(newLocation) but unfortunately, when I did this, my client side code wasn’t even reached (I’m thinking that the code syntax is incorrect, yet no error was given on chrome)

b. I then tried to learn how to delete it and create another one, yet I cannot find any resources from http://msdn.microsoft.com/en-us/library/gg427610.aspx – maybe I am not searching well enough.

Can anyone provide me with some guide on how to move a push pin and how to delete one? Thank you all very very much

var loc = new Microsoft.Maps.Location(lat, lon);

var pin = new Microsoft.Maps.Pushpin(loc);

Edit: partial answer

Removing a push pin:

if (pin != null)
{
    map.entities.remove(pin)
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:42:13+00:00Added an answer on June 1, 2026 at 8:42 pm

    To move a pushpin, setLocation() is indeed the function you need to use. Are you trying to call setLocation from an event handler on the map? If that’s the case, it’s possible that the event handler wasn’t set up properly so it is never called. However, if you already have defined a pushpin(with a variable name myPushpin) and inserted it into the map, then executing the follow code will move it:

    // Move pushpin to "38.0", "-97.0"
    var loc = new Microsoft.Maps.Location(38.0, -97.0);
    myPushpin.setLocation(loc);
    

    To see this in action, head over to the Ajax Bing Maps v7 interactive SDK, modify the code in blue on the lower center of the screen by putting in different coordinates, hit the Run button and see the pushpin move.

    To delete a pushpin that has been added to the map, you need to remove it from the EntityCollection from which it was added to. For example, if you simply inserted the Pushpin into yourmap.entities, this is how you remove it:

    var index = yourmap.entities.indexOf(myPushpin);
    if (index != -1) {
        yourmap.entities.removeAt(index);
    }
    

    Or you can just remove it directly without using an index:

    yourmap.entities.remove(myPushpin);
    

    UPDATE:
    To delete a pushpin when the user clicks on it, you essentially have to first identify the pushpin that was clicked in the click event handler. The pushpin can be obtained from the target Property of the MouseEventArgs Object that is passed into your click handler:

    Microsoft.Maps.Events.addHandler(pushpin, 'click', function (mouseEvent) {
        var pushPinThatWasClicked = mouseEvent.target;
        // Do whatever you want with pushPinThatWasClicked 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently learning about JSF 2.0 and i would like to ask about how
I am currently learning about widgets in Android. I want to create a WIFI
Currently I'm learning about neural networks and I'm trying to create an application that
I currently learning about scrum and want to learn from experienced professionals in the
I am currently learning about basic networking in java. I have been playing around
I'm currently learning about pointers in my C++ book (Programming: Principles and Practice using
I'm currently learning about binary trees and binary search trees, and one of the
I'm currently learning a bit more about Linq-To-Entities - particularly at the moment about
I am currently learning C# and LINQ. I have lots of questions about them.
Happy easters, everyone. I am currently learning topological sort and having a question about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.