Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| delete all pushpins on a map 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 |
| |||
|
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();
}
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();
}
}
}
Of course you should use the same pushpin names you used to create them. Bye! |
| |||
|
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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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 |
| |||
| 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();
}
|
| |||
| 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 |
| |||
| 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.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| Re: delete all pushpins on a map
Sorry I was incomplete. Map in Paul his reply is the ActiveMap property.
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| 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 |
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.