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

Clearing all pushpin

This is a discussion on Clearing all pushpin within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi, how can i remove all pushpins from a map? regards.....

  1. #1
    Gianmaria is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    47

    Clearing all pushpin

    Hi,
    how can i remove all pushpins from a map?

    regards..

  2. #2
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Code:
                MapPoint.DataSets ds = MP.ActiveMap.DataSets;
                object o = "My Pushpins";
                Recordset rs = MP.ActiveMap.DataSets.get_Item(ref o).QueryAllRecords();
                rs.MoveFirst();
                while (!rs.EOF) {
                    rs.Pushpin.Delete();
                    rs.MoveNext();
                }
    This is another approach:

    Code:
                object o = "My Pushpins";
                try {
                    MapPoint.DataSet myPushpins = MP.ActiveMap.DataSets.get_Item(ref o);
                    myPushpins.Delete();
                } catch {
                    // Dataset does not exists
                }

  3. #3
    Gianmaria is offline Member Yellow Belt
    Join Date
    Dec 2004
    Posts
    47
    Not works.. sorry...

    it say..

    The member on the request collection doesent exist.. use a valid name or an index

    for each of your example i receive same error.

    regards.

  4. #4
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    Strange, I tryed both and both are working. Try following:

    Code:
    object o = 1;
    Instead fo the "My Pushpins". I test it and it works also. The first database is the one with the pushpins. Unless of course you have explicitely stored somewhere else (by moving them to another).

    I tested it with C# and Mappoint 2004 but should work with other versions also.

  5. #5
    cwrude is offline Junior Member Yellow Belt
    Join Date
    Nov 2004
    Posts
    19
    You can try this:

    Dim i as int
    Do While oMap.DataSets.Count > 0
    i = oMap.DataSets.Count
    oMap.DataSets(i).Delete
    Loop

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to Calculate 2 itineraries without clearing ActiveRoute
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 12-13-2004, 10:54 AM
  2. clearing pushpins
    By starbuck in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 10-19-2003, 04:32 PM
  3. Finding Pushpin Name by clicking on the Pushpin?(MP 2002)
    By NickSP in forum MapPoint Desktop Discussion
    Replies: 4
    Last Post: 01-10-2003, 01:11 PM
  4. Clearing the
    By Anonymous in forum MP2K Magazine Articles
    Replies: 0
    Last Post: 07-13-2001, 12:48 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