MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




delete all pushpins on a map

This is a discussion on delete all pushpins on a map within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; hi all i have this problem: how can i delete all pushpins which were added to a map ? i ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-04-2006
Junior Member
Yellow Belt
 
Join Date: Sep 2006
Posts: 14
delete all pushpins on a map

hi all i have this problem:

how can i delete all pushpins which were added to a map ?

i don't want to add a pushpin anf then delete it but add for example 10 pushpins and then from a control, it would be a button , delete all those i have added

i hope someone can help me
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 10-04-2006
Junior Member
White Belt
 
Join Date: Sep 2006
Posts: 6
Hi Bule,

To remove all the pushpin you've created you should use the follow code snippet (assuming your map is called "map"):

Code:
foreach (MapPoint.DataSet objDataSet in map.DataSets)
{
if (objDataSet.Name == "My Pushpins")
{
objDataSet.Delete();
}
This because all the Pushpin added by the user ar added in the DataSet "My Pushpins".

Otherwise, if you want to remove only some pushpin you should use something like the follow code snippet:

Code:
foreach (MapPoint.DataSet objDataSet in map.DataSets)
{
if (objDataSet.Name == "My Pushpins")
{
  Recordset rs = objDataSet.QueryAllRecords();
  while (!rs.EOF)
  {
      if (rs.Pushpin.Name.StartsWith("PushPinToDelete1") ||
          rs.Pushpin.Name.StartsWith("PushPinToDelete2"))
      rs.Pushpin.Delete();
      rs.MoveNext();
   }
 }
}
In this example the pushpin named "PushPinToDelete1" and "PushPinToDelete2" will be deleted.
Of course you should use the same pushpin names you used to create them.

Bye!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 10-04-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Hi,

Very right. In addition, remember that if you delete the dataset (first example and very fast), then you have to check for NULL if other parts of code want to work with it. The dataset is automically recreated if adding a pushpin again.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 10-05-2006
Junior Member
Yellow Belt
 
Join Date: Sep 2006
Posts: 14
Thanks a lot ....this is the replay i was waiting for...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 05-16-2007
Junior Member
Yellow Belt
 
Join Date: May 2007
Location: Germany
Posts: 13
Re: delete all pushpins on a map

Hi!

This is also the code I looked for... and it works great!

But... what if you have the German or, for example, the French version of MapPoint? In the German version the DataSet's name is "Meine Pins" instead of "My Pushpins".

Is there a solution which is language-independent?

Regards,
Dietmar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 05-16-2007
Senior Member
Green Belt
 
Join Date: Sep 2005
Location: Marshall, Michigan
Posts: 122
Re: delete all pushpins on a map

If you wish to delete all pushpins from the map, simply:

Code:
foreach (MapPoint.DataSet objDataSet in map.DataSets)
{
if (objDataSet.DataMapType == geoDataMapTypePushpin)
{
objDataSet.Delete();
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 05-17-2007
Junior Member
Yellow Belt
 
Join Date: May 2007
Location: Germany
Posts: 13
Re: delete all pushpins on a map

Hi Paul,

thanks! I use Delphi, but I understand your code.
There is only a little question I have: Of what type is your "MapPoint" object? I think I have to use the Map Object to access the DataSets, e.g. FMap.DataSets

Regards
Dietmar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 05-17-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Re: delete all pushpins on a map

hi Dietmar,

Yes MP.ActiveMap (where MP is the name of the activeX component) translate to you as TMappointClass.FMap.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 05-17-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,055
Re: delete all pushpins on a map

Sorry I was incomplete. Map in Paul his reply is the ActiveMap property.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Need to add Pushpins, but be able to delete them easily BobFromBoston MapPoint 2006/2009 Discussion 1 04-18-2006 02:12 PM
don't delete pushpin sdonta MapPoint 2006/2009 Discussion 1 03-03-2005 12:57 PM
Don't delete my pushpins! Anonymous MapPoint 2006/2009 Discussion 2 06-15-2004 11:39 AM
Add and Delete pushpins on mappoint Anonymous MapPoint 2006/2009 Discussion 3 06-12-2003 01:55 AM
delete countries Anonymous MapPoint 2006/2009 Discussion 1 11-19-2002 10:59 AM


All times are GMT -5. The time now is 01:56 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Ski Resorts
Choose from the comprehensive range of ski resorts at Holiday Hypermarket. Search for ski holidays online at Holiday Hypermarket to find ski holidays that are right for you.

Italy Holidays
Find and book Italy Holidays with Travel Counsellors. Holiday destinations around the world including Italy.

Holiday Jamaica
What springs to mind when you hear the word Jamaica? Bob Marley and Rum? Think again. Book a low cost holiday in Jamaica to explore this island for yourself.

St Lucia Holidays
St Lucia holidays offer something for everyone. Enjoyed by families and young couples alike, St Lucia is a great destination. See online!

Cheap Holidays
Hunting for cheap holidays? Well save time by booking online with ulookubook.com and you can even check out our top tips to help you hunt down a bargain holiday.

Compare holiday prices
Compare holiday prices online where you can see all the possibilities at Travel.co.uk

Cheap Holidays to Gran Canaria
Book a flight to the Canary Islands! View information on cheap holidays to Gran Canaria online at On The Beach.


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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51